|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# Cancel superseded runs on the same PR/branch — saves minutes when pushing fixups. |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-test: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + env: |
| 23 | + DOTNET_NOLOGO: true |
| 24 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 25 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 26 | + # Belt-and-braces: the snapshot suite already refuses UPDATE_SNAPSHOTS when |
| 27 | + # CI is detected, but pin it off explicitly so a stray env var on the agent |
| 28 | + # can't auto-accept baselines. |
| 29 | + UPDATE_SNAPSHOTS: '0' |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Set up .NET |
| 36 | + uses: actions/setup-dotnet@v4 |
| 37 | + with: |
| 38 | + # Reads global.json for the resolved version; cache keys off the CPM lock. |
| 39 | + global-json-file: global.json |
| 40 | + cache: true |
| 41 | + cache-dependency-path: Directory.Packages.props |
| 42 | + |
| 43 | + - name: Restore |
| 44 | + run: dotnet restore DiagramForge.slnx |
| 45 | + |
| 46 | + - name: Build |
| 47 | + run: dotnet build DiagramForge.slnx --no-restore --configuration Release |
| 48 | + |
| 49 | + - name: Test |
| 50 | + run: > |
| 51 | + dotnet test DiagramForge.slnx |
| 52 | + --no-build |
| 53 | + --configuration Release |
| 54 | + --logger "trx;LogFilePrefix=results" |
| 55 | + --results-directory TestResults |
| 56 | +
|
| 57 | + # Upload the snapshot .actual.svg gallery even (especially) when tests fail — |
| 58 | + # that's when you most want to eyeball the rendered output. |
| 59 | + - name: Upload rendered snapshots |
| 60 | + if: always() |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: snapshots |
| 64 | + path: artifacts/test-results/snapshots/ |
| 65 | + if-no-files-found: ignore |
| 66 | + retention-days: 7 |
| 67 | + |
| 68 | + - name: Upload test results |
| 69 | + if: always() |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: test-results |
| 73 | + path: TestResults/ |
| 74 | + if-no-files-found: warn |
| 75 | + retention-days: 7 |
0 commit comments