Repository navigation
Run .NET Matrix Reports #15
This file contains hidden or 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
| name: Run .NET Matrix Reports | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| libraries: | |
| description: "Library filter (comma-separated, empty = all)" | |
| required: false | |
| default: "" | |
| benchmarks: | |
| description: "Run benchmarks after feature validation" | |
| type: boolean | |
| default: true | |
| smoke: | |
| description: "Smoke run: one iteration, numbers are not trustworthy" | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| actions: write | |
| concurrency: | |
| group: matrix-reports | |
| cancel-in-progress: false | |
| jobs: | |
| discover: | |
| name: Discover categories | |
| runs-on: ubuntu-latest | |
| outputs: | |
| categories: ${{ steps.matrix.outputs.categories }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Build category matrix | |
| id: matrix | |
| run: | | |
| dotnet run --project ./build -- ci-matrix --output artifacts/ci-matrix.json | |
| echo "categories=$(jq -c . artifacts/ci-matrix.json)" >> "$GITHUB_OUTPUT" | |
| reports: | |
| name: Reports (${{ matrix.category }}) | |
| needs: discover | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 350 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| category: ${{ fromJSON(needs.discover.outputs.categories) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Run .NET Matrix reports | |
| env: | |
| CATEGORY: ${{ matrix.category }} | |
| LIBRARIES: ${{ inputs.libraries }} | |
| RUN_BENCHMARKS: ${{ inputs.benchmarks }} | |
| SMOKE: ${{ inputs.smoke }} | |
| run: | | |
| args=(ci-reports --category "$CATEGORY") | |
| if [[ -n "$LIBRARIES" ]]; then | |
| args+=(--libraries "$LIBRARIES") | |
| fi | |
| if [[ "$SMOKE" == "true" ]]; then | |
| args+=(--smoke) | |
| fi | |
| if [[ "$RUN_BENCHMARKS" != "true" ]]; then | |
| args+=(--skip-benchmarks) | |
| fi | |
| dotnet run --project ./build -- "${args[@]}" | |
| - name: Publish summary | |
| if: always() | |
| run: cat "artifacts/ci-reports/summaries/${{ matrix.category }}.md" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload reports | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: matrix-reports-${{ matrix.category }} | |
| path: artifacts/ci-reports | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge: | |
| name: Merge reports | |
| needs: reports | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download category reports | |
| uses: actions/download-artifact@v7 | |
| with: | |
| pattern: matrix-reports-* | |
| path: artifacts/merged | |
| merge-multiple: true | |
| - name: Publish combined summary | |
| run: | | |
| find artifacts/merged/summaries -type f -name '*.md' -print0 \ | |
| | sort -z \ | |
| | xargs -0 cat >> "$GITHUB_STEP_SUMMARY" | |
| - name: Seal combined artifact | |
| env: | |
| SOURCE_SHA: ${{ github.sha }} | |
| RUN_ID: ${{ github.run_id }} | |
| RUN_ATTEMPT: ${{ github.run_attempt }} | |
| REPOSITORY: ${{ github.repository }} | |
| run: | | |
| cd artifacts/merged | |
| mapfile -t categories < <(find reports -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort) | |
| generated_at="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
| jq -n \ | |
| --arg generatedAtUtc "$generated_at" \ | |
| --arg repository "$REPOSITORY" \ | |
| --arg commitSha "$SOURCE_SHA" \ | |
| --arg workflowRunId "$RUN_ID" \ | |
| --arg workflowRunAttempt "$RUN_ATTEMPT" \ | |
| --args \ | |
| '{ | |
| schemaVersion: 1, | |
| archive: "matrix-reports", | |
| generatedAtUtc: $generatedAtUtc, | |
| repository: $repository, | |
| commitSha: $commitSha, | |
| workflowRunId: $workflowRunId, | |
| workflowRunAttempt: $workflowRunAttempt, | |
| categories: $ARGS.positional | |
| }' "${categories[@]}" > manifest.json | |
| find . -type f ! -name checksums.sha256 -print0 \ | |
| | sort -z \ | |
| | xargs -0 sha256sum > checksums.sha256 | |
| - name: Upload combined reports and evidence | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: matrix-reports | |
| path: artifacts/merged | |
| if-no-files-found: error | |
| retention-days: 90 | |
| - name: Remove temporary category artifacts | |
| if: always() | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const artifacts = await github.paginate( | |
| github.rest.actions.listWorkflowRunArtifacts, | |
| { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| run_id: context.runId, | |
| per_page: 100 | |
| }); | |
| for (const artifact of artifacts) { | |
| if (artifact.name.startsWith("matrix-reports-")) { | |
| await github.rest.actions.deleteArtifact({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| artifact_id: artifact.id | |
| }); | |
| } | |
| } |