|
15 | 15 | required: false |
16 | 16 | default: false |
17 | 17 |
|
| 18 | + |
| 19 | +# This job runs the test suite in two environments: |
| 20 | +# - py_pinned: uses Python 3.11 with the existing poetry.lock file (our stable, pinned dev environment) |
| 21 | +# - py_latest: latest Python version we want to support, without the lock file to furthermore install the newest dependency versions |
| 22 | +# |
| 23 | +# This ensures compatibility with both our controlled dev setup and the latest upstream packages, |
| 24 | +# helping catch issues introduced by dependency updates or newer Python versions. |
18 | 25 | jobs: |
19 | 26 | cpu: |
20 | 27 | runs-on: ubuntu-latest |
21 | 28 | if: "!contains(github.event.head_commit.message, 'ci skip')" |
22 | 29 | strategy: |
23 | 30 | matrix: |
24 | | - python-version: ["3.11"] |
| 31 | + include: |
| 32 | + - env_name: py_pinned |
| 33 | + python-version: "3.11" |
| 34 | + use_lock: true |
| 35 | + - env_name: py_latest |
| 36 | + python-version: "3.13" |
| 37 | + use_lock: false |
| 38 | + |
25 | 39 | steps: |
26 | 40 | - name: Setup tmate session |
27 | 41 | uses: mxschmitt/action-tmate@v3 |
28 | 42 | if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 43 | + |
29 | 44 | - name: Cancel previous run |
30 | 45 | |
31 | 46 | with: |
32 | 47 | access_token: ${{ github.token }} |
| 48 | + |
33 | 49 | - uses: actions/checkout@v3 |
| 50 | + |
34 | 51 | - name: Set up Python ${{ matrix.python-version }} |
35 | 52 | uses: actions/setup-python@v4 |
36 | 53 | with: |
37 | 54 | python-version: ${{ matrix.python-version }} |
38 | | - # use poetry and cache installed packages, see https://github.com/marketplace/actions/python-poetry-action |
| 55 | + |
39 | 56 | - name: Install poetry |
40 | 57 | uses: abatilo/actions-poetry@v2 |
| 58 | + |
41 | 59 | - name: Setup a local virtual environment (if no poetry.toml file) |
42 | 60 | run: | |
43 | 61 | poetry config virtualenvs.create true --local |
44 | 62 | poetry config virtualenvs.in-project true --local |
45 | | - - uses: actions/cache@v3 |
46 | | - name: Define a cache for the virtual environment based on the dependencies lock file |
| 63 | +
|
| 64 | + - name: Remove poetry.lock for latest dependency test |
| 65 | + if: ${{ !matrix.use_lock }} |
| 66 | + run: rm -f poetry.lock |
| 67 | + |
| 68 | + - name: Define a cache for the virtual environment based on the dependencies lock file |
| 69 | + if: matrix.use_lock |
| 70 | + uses: actions/cache@v3 |
47 | 71 | with: |
48 | 72 | path: ./.venv |
49 | | - key: venv-${{ hashFiles('poetry.lock') }} |
| 73 | + key: venv-${{ matrix.env_name }}-${{ hashFiles('poetry.lock') }} |
| 74 | + restore-keys: | |
| 75 | + venv-${{ matrix.env_name }}- |
| 76 | +
|
50 | 77 | - name: Install the project dependencies |
51 | 78 | run: | |
52 | | - poetry install --with dev --extras "envpool eval" |
| 79 | + if [ "${{ matrix.env_name }}" = "py_latest" ]; then |
| 80 | + poetry install --with dev --extras "eval" |
| 81 | + else |
| 82 | + poetry install --with dev --extras "envpool eval" |
| 83 | + fi |
| 84 | +
|
| 85 | + - name: List installed packages |
| 86 | + run: | |
| 87 | + poetry run pip list |
| 88 | +
|
53 | 89 | - name: wandb login |
54 | 90 | run: | |
55 | 91 | poetry run wandb login e2366d661b89f2bee877c40bee15502d67b7abef |
| 92 | +
|
56 | 93 | - name: Test with pytest |
57 | | - # ignore test/throughput which only profiles the code |
58 | 94 | run: | |
59 | | - poetry run poe test |
| 95 | + if [ "${{ matrix.env_name }}" = "py_pinned" ]; then |
| 96 | + poetry run poe test |
| 97 | + else |
| 98 | + poetry run poe test-nocov |
| 99 | + fi |
60 | 100 | - name: Upload coverage to Codecov |
| 101 | + if: matrix.env_name == 'py_pinned' |
61 | 102 | uses: codecov/codecov-action@v1 |
62 | 103 | with: |
63 | 104 | token: ${{ secrets.CODECOV }} |
64 | 105 | file: ./coverage.xml |
65 | | - flags: unittests |
66 | | - name: codecov-umbrella |
| 106 | + flags: ${{ matrix.env_name }} |
| 107 | + name: codecov-${{ matrix.env_name }} |
67 | 108 | fail_ci_if_error: false |
0 commit comments