Skip to content

Commit 627d67d

Browse files
committed
ci: verify semantic conventions generation
Signed-off-by: ihopenre-eng <247072151+ihopenre-eng@users.noreply.github.com>
1 parent 047ccdd commit 627d67d

4 files changed

Lines changed: 37 additions & 41 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,39 @@ jobs:
665665
run-tests: false # Note: No test project
666666
trigger: ${{ github.event_name }}
667667

668+
verify-semanticconventions:
669+
name: Verify semantic conventions generation
670+
needs: detect-changes
671+
if: |
672+
contains(needs.detect-changes.outputs.changes, 'semanticconventions')
673+
|| contains(needs.detect-changes.outputs.changes, 'build')
674+
runs-on: ubuntu-24.04
675+
timeout-minutes: 15
676+
steps:
677+
- name: Checkout code
678+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
679+
with:
680+
persist-credentials: false
681+
show-progress: false
682+
683+
- name: Regenerate semantic conventions
684+
shell: pwsh
685+
run: |
686+
Remove-Item -Recurse -Force ./src/OpenTelemetry.SemanticConventions/Attributes
687+
New-Item -ItemType Directory ./src/OpenTelemetry.SemanticConventions/Attributes
688+
./src/OpenTelemetry.SemanticConventions/scripts/generate.ps1
689+
690+
- name: Verify generated files are up to date
691+
shell: pwsh
692+
run: |
693+
$generatedFiles = git status --short --untracked-files=all -- ./src/OpenTelemetry.SemanticConventions/Attributes
694+
if ($generatedFiles) {
695+
$generatedFiles | Write-Output
696+
Write-Output "Run ./src/OpenTelemetry.SemanticConventions/scripts/generate.ps1 and commit the results."
697+
Write-Error "Generated semantic convention files are out of date."
698+
exit 1
699+
}
700+
668701
build-test-contrib-shared-tests:
669702
needs: detect-changes
670703
if: |

src/OpenTelemetry.SemanticConventions/README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@ dotnet add package OpenTelemetry.SemanticConventions --prerelease
1414
This project uses
1515
[Weaver](https://github.com/open-telemetry/weaver).
1616
The folder `scripts` at the top level of the project contains the template
17-
and the script files used in the process.
17+
and PowerShell script used in the process.
1818

19-
To generate the code files, run:
20-
21-
```shell
22-
./scripts/generate.sh
23-
```
24-
25-
Or, with PowerShell:
19+
To generate the code files, run the PowerShell script:
2620

2721
```shell
2822
./scripts/generate.ps1

src/OpenTelemetry.SemanticConventions/scripts/generate.ps1

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env pwsh
2+
13
$SCRIPT_DIR = $PSScriptRoot
24
$ROOT_DIR = "${SCRIPT_DIR}/../"
35

src/OpenTelemetry.SemanticConventions/scripts/generate.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)