|
7 | 7 |
|
8 | 8 | permissions: |
9 | 9 | contents: read |
10 | | - checks: write |
| 10 | + actions: read |
11 | 11 |
|
12 | 12 | concurrency: |
13 | 13 | group: push-lock-${{ github.ref }} |
@@ -219,73 +219,81 @@ jobs: |
219 | 219 | --profiling-format=google-trace |
220 | 220 |
|
221 | 221 | - name: Container – Build & Install Nabla |
| 222 | + id: build-nabla |
222 | 223 | run: | |
223 | 224 | docker exec orphan ` |
224 | 225 | ${{ env.entry }} ${{ env.cmd }} -Command cmake --build ` |
225 | 226 | --preset ci-build-dynamic-${{ matrix.vendor }} ` |
226 | 227 | --target install ` |
227 | 228 | --config ${{ matrix.config }} |
228 | 229 |
|
229 | | - - name: API / Examples / Check Run (Create) |
230 | | - id: check-run-create |
231 | | - uses: actions/github-script@v6 |
232 | | - with: |
233 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
234 | | - result-encoding: string |
235 | | - script: | |
236 | | - const headSha = context.payload.pull_request ? context.payload.pull_request.head.sha : context.sha; |
237 | | - const response = await github.rest.checks.create({ |
238 | | - owner: context.repo.owner, |
239 | | - repo: context.repo.repo, |
240 | | - name: `Examples (${{ matrix.os }}, ${{ matrix.vendor }}-${{ matrix.tag }}, ${{ matrix.config }})`, |
241 | | - head_sha: headSha, |
242 | | - status: 'in_progress' |
243 | | - }); |
244 | | - return response.data.id; |
245 | | -
|
246 | 230 | - name: Container – Build & Install Examples |
247 | 231 | id: build-examples |
248 | 232 | continue-on-error: true |
| 233 | + shell: pwsh |
249 | 234 | run: | |
250 | | - docker exec orphan ` |
| 235 | + $statusDir = Join-Path $env:RUNNER_TEMP "examples-status" |
| 236 | + New-Item -ItemType Directory -Force -Path $statusDir | Out-Null |
| 237 | +
|
| 238 | + $buildLog = Join-Path $statusDir "build-examples.log" |
| 239 | + $installLog = Join-Path $statusDir "install-examples.log" |
| 240 | +
|
| 241 | + & docker exec orphan ` |
251 | 242 | ${{ env.entry }} ${{ env.cmd }} -Command cmake --build ` |
252 | 243 | --preset ci-build-dynamic-${{ matrix.vendor }} ` |
253 | 244 | -t examples_tests\all --config ${{ matrix.config }} ` |
254 | | - -- -k 0 |
| 245 | + -- -k 0 2>&1 | Tee-Object -FilePath $buildLog |
| 246 | + $buildExitCode = $LASTEXITCODE |
| 247 | +
|
| 248 | + if ($buildExitCode -eq 0) { |
| 249 | + & docker exec orphan ` |
| 250 | + ${{ env.entry }} ${{ env.cmd }} -Command cmake --install ` |
| 251 | + ${{ env.binary }}\examples_tests --config ${{ matrix.config }} ` |
| 252 | + --prefix ${{ env.install }} 2>&1 | Tee-Object -FilePath $installLog |
| 253 | + $installExitCode = $LASTEXITCODE |
| 254 | + } else { |
| 255 | + "Skipped because the Examples build failed." | Set-Content -Path $installLog -Encoding ascii |
| 256 | + $installExitCode = 1 |
| 257 | + } |
255 | 258 |
|
256 | | - docker exec orphan ` |
257 | | - ${{ env.entry }} ${{ env.cmd }} -Command cmake --install ` |
258 | | - ${{ env.binary }}\examples_tests --config ${{ matrix.config }} ` |
259 | | - --prefix ${{ env.install }} |
| 259 | + if ($buildExitCode -ne 0) { |
| 260 | + exit $buildExitCode |
| 261 | + } |
| 262 | +
|
| 263 | + if ($installExitCode -ne 0) { |
| 264 | + exit $installExitCode |
| 265 | + } |
260 | 266 |
|
261 | | - - name: API / Examples / Check Run (Conclusion) |
262 | | - id: outcome-examples |
| 267 | + - name: Record Examples result |
| 268 | + if: ${{ always() }} |
| 269 | + shell: pwsh |
263 | 270 | run: | |
264 | | - $completedAt = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") |
265 | | - if ("${{ steps.build-examples.outcome }}" -eq "success") { |
266 | | - "conclusion=success" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
| 271 | + $examplesResult = if ( |
| 272 | + "${{ steps.build-nabla.outcome }}" -eq "success" -and |
| 273 | + "${{ steps.build-examples.outcome }}" -eq "success" |
| 274 | + ) { |
| 275 | + "success" |
267 | 276 | } else { |
268 | | - "conclusion=failure" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
| 277 | + "failure" |
269 | 278 | } |
270 | | - "completed_at=$completedAt" | Out-File -FilePath $env:GITHUB_OUTPUT -Append |
271 | | -
|
272 | | - - name: API / Examples / Check Run (Update) |
273 | | - uses: actions/github-script@v6 |
| 279 | + $statusDir = Join-Path $env:RUNNER_TEMP "examples-status" |
| 280 | + New-Item -ItemType Directory -Force -Path $statusDir | Out-Null |
| 281 | + $statusFile = Join-Path $statusDir "status.txt" |
| 282 | + $detailsFile = Join-Path $statusDir "details.txt" |
| 283 | + $examplesResult | Set-Content -Path $statusFile -Encoding ascii -NoNewline |
| 284 | + @( |
| 285 | + "build-nabla=${{ steps.build-nabla.outcome }}" |
| 286 | + "build-examples=${{ steps.build-examples.outcome }}" |
| 287 | + "result=$examplesResult" |
| 288 | + ) | Set-Content -Path $detailsFile -Encoding ascii |
| 289 | +
|
| 290 | + - name: Upload Examples result |
| 291 | + if: ${{ always() }} |
| 292 | + uses: actions/upload-artifact@v4 |
274 | 293 | with: |
275 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
276 | | - script: | |
277 | | - await github.rest.checks.update({ |
278 | | - owner: context.repo.owner, |
279 | | - repo: context.repo.repo, |
280 | | - check_run_id: ${{ steps.check-run-create.outputs.result }}, |
281 | | - status: 'completed', |
282 | | - conclusion: '${{ steps.outcome-examples.outputs.conclusion }}', |
283 | | - completed_at: '${{ steps.outcome-examples.outputs.completed_at }}', |
284 | | - output: { |
285 | | - title: '', |
286 | | - summary: '[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) to see details.' |
287 | | - } |
288 | | - }); |
| 294 | + name: examples-status-${{ matrix.os }}-${{ matrix.vendor }}-${{ matrix.tag }}-${{ matrix.config }} |
| 295 | + path: ${{ runner.temp }}/examples-status |
| 296 | + if-no-files-found: error |
289 | 297 |
|
290 | 298 | - name: Container – Save NSC Image |
291 | 299 | run: | |
@@ -436,6 +444,53 @@ jobs: |
436 | 444 | run: | |
437 | 445 | docker push ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }} |
438 | 446 |
|
| 447 | + examples-status: |
| 448 | + name: Examples (${{ matrix.os }}, ${{ matrix.vendor }}-${{ matrix.tag }}, ${{ matrix.config }}) |
| 449 | + needs: build-windows |
| 450 | + if: ${{ always() }} |
| 451 | + runs-on: ubuntu-latest |
| 452 | + strategy: |
| 453 | + fail-fast: false |
| 454 | + matrix: |
| 455 | + vendor: [msvc] |
| 456 | + config: [Release, Debug, RelWithDebInfo] |
| 457 | + tag: ['17.13.6'] |
| 458 | + os: [windows-2022] |
| 459 | + |
| 460 | + steps: |
| 461 | + - name: Download Examples result |
| 462 | + uses: actions/download-artifact@v4 |
| 463 | + with: |
| 464 | + name: examples-status-${{ matrix.os }}-${{ matrix.vendor }}-${{ matrix.tag }}-${{ matrix.config }} |
| 465 | + path: examples-status |
| 466 | + |
| 467 | + - name: Fail if Examples did not succeed |
| 468 | + shell: bash |
| 469 | + run: | |
| 470 | + status_file="examples-status/status.txt" |
| 471 | + if [[ ! -f "$status_file" ]]; then |
| 472 | + echo "Missing Examples status artifact" |
| 473 | + exit 1 |
| 474 | + fi |
| 475 | +
|
| 476 | + result="$(tr -d '\r\n' < "$status_file")" |
| 477 | + echo "Examples result: $result" |
| 478 | +
|
| 479 | + if [[ "$result" != "success" ]]; then |
| 480 | + if [[ -f "examples-status/details.txt" ]]; then |
| 481 | + echo "Details:" |
| 482 | + cat "examples-status/details.txt" |
| 483 | + fi |
| 484 | + for file in "examples-status/build-examples.log" "examples-status/install-examples.log"; do |
| 485 | + if [[ -f "$file" ]]; then |
| 486 | + echo "::group::$(basename "$file")" |
| 487 | + cat "$file" |
| 488 | + echo "::endgroup::" |
| 489 | + fi |
| 490 | + done |
| 491 | + exit 1 |
| 492 | + fi |
| 493 | +
|
439 | 494 | update-badges: |
440 | 495 | name: Update Build & Image Badges |
441 | 496 | if: ${{ always() && github.ref == 'refs/heads/master' }} |
|
0 commit comments