|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, dev] |
| 6 | + pull_request: |
| 7 | + branches: [main, dev] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-standard: |
| 11 | + name: test-standard |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 30 |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup .NET |
| 19 | + uses: actions/setup-dotnet@v4 |
| 20 | + with: |
| 21 | + dotnet-version: 10.x |
| 22 | + |
| 23 | + - name: Restore |
| 24 | + run: dotnet restore Source/KZDev.PerfUtils.sln |
| 25 | + |
| 26 | + - name: Build |
| 27 | + run: dotnet build Source/KZDev.PerfUtils.sln -c Release |
| 28 | + |
| 29 | + - name: Test (standard) |
| 30 | + run: dotnet test Source/KZDev.PerfUtils.sln -c Release --no-build |
| 31 | + |
| 32 | + - name: Upload Release artifacts |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: test-release-artifacts |
| 36 | + path: artifacts |
| 37 | + if-no-files-found: error |
| 38 | + |
| 39 | + test-explicit: |
| 40 | + name: test-explicit |
| 41 | + needs: [test-standard] |
| 42 | + runs-on: ubuntu-latest |
| 43 | + timeout-minutes: 45 |
| 44 | + # test-explicit failures are non-blocking only for PRs whose base is not main, or for pushes to dev. |
| 45 | + # They remain blocking for PRs into main and for pushes to main (aligned with branch-protection intent). |
| 46 | + continue-on-error: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name == 'push' && github.ref == 'refs/heads/dev') }} |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Setup .NET |
| 52 | + uses: actions/setup-dotnet@v4 |
| 53 | + with: |
| 54 | + dotnet-version: 10.x |
| 55 | + |
| 56 | + - name: Download build artifacts |
| 57 | + uses: actions/download-artifact@v4 |
| 58 | + with: |
| 59 | + name: test-release-artifacts |
| 60 | + path: artifacts |
| 61 | + |
| 62 | + - name: Apply serialized xUnit runner for Explicit |
| 63 | + run: | |
| 64 | + set -euo pipefail |
| 65 | + count=0 |
| 66 | + while IFS= read -r -d '' f; do |
| 67 | + cp Source/Tst/xunit.runner.explicit.json "$f" |
| 68 | + count=$((count + 1)) |
| 69 | + done < <(find artifacts/bin -name xunit.runner.json -print0) |
| 70 | + if [ "$count" -eq 0 ]; then |
| 71 | + echo "No xunit.runner.json found under artifacts/bin; cannot apply explicit runner overlay." |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + echo "Overlay applied to ${count} xunit.runner.json file(s)." |
| 75 | +
|
| 76 | + - name: Test (Explicit only, sequential xUnit) |
| 77 | + run: | |
| 78 | + dotnet test Source/KZDev.PerfUtils.sln -c Release --no-build \ |
| 79 | + --filter "TestMode=Explicit" \ |
| 80 | + -- xUnit.Explicit=only xUnit.MaxParallelThreads=1 xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false |
0 commit comments