-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc94569
commit 016ea1f
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Semantic Conventions - validate | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "src/OpenTelemetry.SemanticConventions/**" | ||
|
||
jobs: | ||
run-dotnet-format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check script versions | ||
shell: pwsh | ||
run: .\build\scripts\check-semconv-versions.ps1 | ||
|
||
- name: Generate semantic conventions | ||
working-directory: src\OpenTelemetry.SemanticConventions | ||
shell: pwsh | ||
run: | | ||
.\scripts\generate.ps1 | ||
- name: Verify no changes | ||
working-directory: src\OpenTelemetry.SemanticConventions | ||
run: | | ||
git diff --exit-code '.' || (echo 'Manual changes to Semantic Convention attributes are not allowed. Please re-generate the files and commit.' && exit 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
$rootDirectory = Get-Location | ||
|
||
$PowerShellScript = "$($rootDirectory)\src\OpenTelemetry.SemanticConventions\scripts\generate.ps1" | ||
$BashScript = "$($rootDirectory)\src\OpenTelemetry.SemanticConventions\scripts\generate.sh" | ||
|
||
# PS semconv version | ||
$PsSemConvVersion = Select-String -Path $PowerShellScript -Pattern '\$SEMCONV_VERSION="([^"]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } | ||
# PS weaver version | ||
$PsWeaverVersion = Select-String -Path $PowerShellScript -Pattern '\$GENERATOR_VERSION="([^"]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } | ||
|
||
# Bash semconv version | ||
$BashSemConvVersion = Select-String -Path $BashScript -Pattern 'SEMCONV_VERSION="([^"]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } | ||
# Bash weaver version | ||
$BashWeaverVersion = Select-String -Path $BashScript -Pattern 'SEMCONV_VERSION="([^"]+)"' | ForEach-Object { $_.Matches.Groups[1].Value } | ||
|
||
# Check if the semconv versions match | ||
if ($PsSemConvVersion -ne $BashSemConvVersion) { | ||
Write-Host "Semantic Convention version mismatch detected!" | ||
Write-Host "PowerShell version: $PsSemConvVersion" | ||
Write-Host "Bash version: $BashSemConvVersion" | ||
exit 1 | ||
} | ||
|
||
# Check if the weaver versions match | ||
if ($PsWeaverVersion -ne $BashWeaverVersion) { | ||
Write-Host "Weaver version mismatch detected!" | ||
Write-Host "PowerShell version: $PsWeaverVersion" | ||
Write-Host "Bash version: $BashWeaverVersion" | ||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters