openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.11.0-oidc.test1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/integrity-checks.yml

143lines · modecode

1# This workflow validates code generation and API export integrity by running
2# the relevant scripts and ensuring they complete without producing changes.
3name: Code integrity checks
4
5on:
6 pull_request:
7 paths:
8 - 'codegen/**'
9 - 'specification/**'
10 - 'OpenAI/src/**'
11 - 'OpenAI.Responses/src/**'
12 - 'package.json'
13 - 'global.json'
14 - 'package-lock.json'
15 - '.github/workflows/integrity-checks.yml'
16 - 'scripts/Invoke-CodeGen.ps1'
17 - 'scripts/Export-Api.ps1'
18 - 'api/**'
19 - 'Directory.Build.targets'
20 - 'tests/Snippets/**'
21 - 'README.md'
22 - 'scripts/Update-Snippets.ps1'
23 types: [opened, reopened, synchronize]
24 workflow_dispatch:
25
26permissions:
27 contents: read
28
29jobs:
30 validate-codegen:
31 name: Validate code generation
32 runs-on: ubuntu-latest
33
34 steps:
35 - name: Checkout code
36 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37
38 - name: Set up Node.js
39 uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
40 with:
41 node-version: '22.x'
42
43 - name: Set up .NET
44 uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
45 with:
46 # Use the version specified in global.json
47 global-json-file: global.json
48
49 - name: Run Invoke-CodeGen script
50 shell: pwsh
51 run: |
52 Write-Host "Running code generation validation..."
53 ./scripts/Invoke-CodeGen.ps1 -Clean
54
55 if ($LASTEXITCODE -ne 0) {
56 Write-Error "Code generation failed with exit code: $LASTEXITCODE"
57 exit $LASTEXITCODE
58 }
59
60 Write-Host "Code generation completed successfully!"
61
62 - name: Check for uncommitted changes
63 uses: ./.github/actions/check-uncommitted-changes
64 with:
65 error-message: "Code generation produced changes. Please run './scripts/Invoke-CodeGen.ps1' locally and commit the results."
66
67 - name: Run codegen visitor tests
68 run: dotnet test codegen/generator/test/
69 --configuration Release
70 --logger "trx;LogFilePrefix=codegen"
71 --results-directory ${{github.workspace}}/artifacts/test-results
72 ${{ env.version_suffix_args}}
73
74 - name: Upload artifacts
75 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
76 if: ${{ !cancelled() }}
77 with:
78 name: build-artifacts
79 path: ${{github.workspace}}/artifacts
80
81 validate-api-export:
82 name: Validate API export
83 runs-on: ubuntu-latest
84
85 steps:
86 - name: Checkout code
87 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
88
89 - name: Set up .NET
90 uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
91 with:
92 # Use the version specified in global.json
93 global-json-file: global.json
94
95 - name: Run Export-Api script
96 shell: pwsh
97 run: |
98 Write-Host "Running API export validation..."
99 ./scripts/Export-Api.ps1
100
101 if ($LASTEXITCODE -ne 0) {
102 Write-Error "API export failed with exit code: $LASTEXITCODE"
103 exit $LASTEXITCODE
104 }
105
106 Write-Host "API export completed successfully!"
107
108 - name: Check for uncommitted changes
109 uses: ./.github/actions/check-uncommitted-changes
110 with:
111 error-message: "API export produced changes. Please run './scripts/Export-Api.ps1' locally and commit the results."
112
113 validate-snippets:
114 name: Validate documentation snippets
115 runs-on: ubuntu-latest
116
117 steps:
118 - name: Checkout code
119 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
120
121 - name: Set up .NET
122 uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
123 with:
124 # Use the version specified in global.json
125 global-json-file: global.json
126
127 - name: Run Update-Snippets script
128 shell: pwsh
129 run: |
130 Write-Host "Running snippet update validation..."
131 ./scripts/Update-Snippets.ps1
132
133 if ($LASTEXITCODE -ne 0) {
134 Write-Error "Snippet update failed with exit code: $LASTEXITCODE"
135 exit $LASTEXITCODE
136 }
137
138 Write-Host "Snippet update completed successfully!"
139
140 - name: Check for uncommitted changes
141 uses: ./.github/actions/check-uncommitted-changes
142 with:
143 error-message: "Documentation snippets are out of date. Please run './scripts/Update-Snippets.ps1' locally and commit the results."
144