diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee3276b6..5b677a86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,42 +2,28 @@ name: Cross-platform tests on: pull_request: + paths-ignore: ['docs/**', '**/*.md'] push: branches: [master] + paths-ignore: ['docs/**', '**/*.md'] permissions: contents: read +# A newer push to the same branch or pull request supersedes a run in progress; +# dev-build publishes only master's newest commit anyway. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# Runners are billed per job, rounded up to the minute, and each job restores +# and builds the shared projects again. So the small suites share one job and +# build once; Engine.Tests, the longest, runs beside them in its own. jobs: - unit-tests: - name: Unit tests (${{ matrix.project }}) + suites: + name: Unit tests and synthetic nests runs-on: ubuntu-latest timeout-minutes: 30 - strategy: - fail-fast: false - max-parallel: 4 - matrix: - project: - - OpenNest.Tests - - OpenNest.Desktop.Tests - - OpenNest.Engine.Tests - - OpenNest.IO.Tests - - OpenNest.Server.Tests - - OpenNest.FrontEnd.Tests - steps: - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - with: - persist-credentials: false - - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 - with: - dotnet-version: '8.0.x' - - name: Run ${{ matrix.project }} - run: dotnet test "${{ matrix.project }}/${{ matrix.project }}.csproj" -c Release - - synthetic-nests: - name: Six synthetic Irregular nests - runs-on: ubuntu-latest - timeout-minutes: 10 steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: @@ -47,16 +33,47 @@ jobs: dotnet-version: '8.0.x' - name: Test fail-closed final CI check run: python3 scripts/test_ci_results.py -v + # Each suite runs even when an earlier one fails, so one run reports them all. + - name: Run OpenNest.Tests + if: ${{ !cancelled() }} + run: dotnet test OpenNest.Tests/OpenNest.Tests.csproj -c Release + - name: Run OpenNest.Desktop.Tests + if: ${{ !cancelled() }} + run: dotnet test OpenNest.Desktop.Tests/OpenNest.Desktop.Tests.csproj -c Release + - name: Run OpenNest.IO.Tests + if: ${{ !cancelled() }} + run: dotnet test OpenNest.IO.Tests/OpenNest.IO.Tests.csproj -c Release + - name: Run OpenNest.Server.Tests + if: ${{ !cancelled() }} + run: dotnet test OpenNest.Server.Tests/OpenNest.Server.Tests.csproj -c Release + - name: Run OpenNest.FrontEnd.Tests + if: ${{ !cancelled() }} + run: dotnet test OpenNest.FrontEnd.Tests/OpenNest.FrontEnd.Tests.csproj -c Release - name: Check six synthetic Irregular nests + if: ${{ !cancelled() }} timeout-minutes: 6 run: | python3 scripts/test_check_synthetic_nests.py -v python3 scripts/check-synthetic-nests.py --parallel 2 + engine-tests: + name: Unit tests (OpenNest.Engine.Tests) + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + persist-credentials: false + - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 + with: + dotnet-version: '8.0.x' + - name: Run OpenNest.Engine.Tests + run: dotnet test OpenNest.Engine.Tests/OpenNest.Engine.Tests.csproj -c Release + # Preserve the existing check name for required-status consumers. tests: name: tests - needs: [unit-tests, synthetic-nests] + needs: [suites, engine-tests] if: ${{ always() }} runs-on: ubuntu-latest timeout-minutes: 5 @@ -66,9 +83,9 @@ jobs: persist-credentials: false - name: Require every test job to succeed env: - UNIT_TEST_RESULT: ${{ needs.unit-tests.result }} - SYNTHETIC_RESULT: ${{ needs.synthetic-nests.result }} - run: bash scripts/check-ci-results.sh "$UNIT_TEST_RESULT" "$SYNTHETIC_RESULT" + SUITES_RESULT: ${{ needs.suites.result }} + ENGINE_RESULT: ${{ needs.engine-tests.result }} + run: bash scripts/check-ci-results.sh "$SUITES_RESULT" "$ENGINE_RESULT" windows-desktop: # WinForms tests need a Windows desktop runtime; the Linux job can only diff --git a/docs/auto-update.md b/docs/auto-update.md index 3bd5e0fe..07542a06 100644 --- a/docs/auto-update.md +++ b/docs/auto-update.md @@ -80,6 +80,8 @@ need the previous release's packages beside the output before `vpk pack`. `.github/workflows/dev-build.yml` runs after every master push whose `Cross-platform tests` pass (that workflow includes the Windows desktop tests). +Pushes that change only `docs/` or Markdown files skip those tests, so they make no +build; the next code push includes them. It packages that commit with `Publish-Windows.ps1` as `X.Y.Z-dev.N`, where `X.Y.Z` is the minor after the newest `vX.Y.Z` tag and `N` the commit count, so each build outranks the last and the next full release outranks them all. It then diff --git a/docs/windows-acceptance.md b/docs/windows-acceptance.md index 66c3a79e..0a4583ba 100644 --- a/docs/windows-acceptance.md +++ b/docs/windows-acceptance.md @@ -1,7 +1,8 @@ # Automated Windows acceptance The `windows-desktop` job in `.github/workflows/ci.yml` runs on GitHub-hosted -`windows-2022` for every pull request and `master` push. It executes the full +`windows-2022` for every pull request and `master` push that changes more than +`docs/` or Markdown files. It executes the full WinForms and FrontEnd test projects in Release, including shown-form STA tests and Windows child-process lifetime tests. No production service, customer fixture, physical GPU, or CNC controller is required. diff --git a/scripts/check-ci-results.sh b/scripts/check-ci-results.sh index 09d07aa4..1c9c7702 100644 --- a/scripts/check-ci-results.sh +++ b/scripts/check-ci-results.sh @@ -1,15 +1,16 @@ #!/usr/bin/env bash -# The stable final CI check succeeds only when both required job groups succeeded. +# The stable final CI check succeeds only when both required test jobs succeeded: +# the shared suites job (with the synthetic nests) and Engine.Tests. set -euo pipefail if [[ $# -ne 2 ]]; then - printf 'Expected unit-test and synthetic-nest job results.\n' >&2 + printf 'Expected suites and engine-tests job results.\n' >&2 exit 1 fi if [[ "$1" != success || "$2" != success ]]; then - printf 'Required CI jobs did not both succeed (unit=%s, synthetic=%s).\n' "$1" "$2" >&2 + printf 'Required CI jobs did not both succeed (suites=%s, engine=%s).\n' "$1" "$2" >&2 exit 1 fi -printf 'All required unit suites and the synthetic-nest gate passed.\n' +printf 'All required unit suites, the synthetic nests and Engine.Tests passed.\n' diff --git a/scripts/test_ci_results.py b/scripts/test_ci_results.py index 1db8e2e5..c25f460a 100644 --- a/scripts/test_ci_results.py +++ b/scripts/test_ci_results.py @@ -21,10 +21,10 @@ class CIResultsTests(unittest.TestCase): def test_both_required_jobs_successful(self): self.assertEqual(self.check("success", "success").returncode, 0) - def test_unit_matrix_failure_blocks_aggregate(self): + def test_suites_failure_blocks_aggregate(self): self.assertNotEqual(self.check("failure", "success").returncode, 0) - def test_synthetic_failure_blocks_aggregate(self): + def test_engine_failure_blocks_aggregate(self): self.assertNotEqual(self.check("success", "failure").returncode, 0) def test_canceled_dependency_blocks_aggregate(self):