Merge pull request #473 from PolicyEngine/dynamics-ex2-artifact-20260927 #1162
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| pytest-shard: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.14'] | |
| shard: [1, 2, 3, 4] | |
| name: pytest-shard (${{ matrix.python-version }}, ${{ matrix.shard }}/4) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| # The birth-evidence identity guard resolves historical | |
| # commits; a shallow clone cannot. | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install package | |
| run: pip install -e ".[dev]" pytest-split | |
| - name: Run tests (shard ${{ matrix.shard }}/4) | |
| run: pytest -q --splits 4 --group ${{ matrix.shard }} --splitting-algorithm duration_based_chunks --durations-path .test_durations | |
| graph-integration: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install the pinned optional graph integration | |
| run: pip install -e ".[graph]" pytest | |
| - name: Require typed graph capabilities | |
| run: python -c "from populace_dynamics.graph._compat import require_graph; require_graph()" | |
| - name: Run graph and existing mortality regressions | |
| run: pytest -q tests/test_graph_mortality.py tests/test_graph_mortality_trajectory.py tests/test_graph_trajectory_accounting.py tests/test_m6_engine_refit.py tests/test_m6_engine_steps.py | |
| # Fan-in jobs keeping the branch-protection context names | |
| # ("pytest (3.11)" / "pytest (3.13)") stable across the shard split. | |
| pytest: | |
| name: pytest (${{ matrix.python-version }}) | |
| needs: [pytest-shard, graph-integration] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.14'] | |
| steps: | |
| - name: Verify all shards passed | |
| run: | | |
| test "${{ needs.pytest-shard.result }}" = "success" | |
| test "${{ needs.graph-integration.result }}" = "success" |