@@ -17,29 +17,38 @@ defaults:
1717 shell : bash -el {0}
1818
1919jobs :
20+ cache-pixi-lock :
21+ uses : ./.github/workflows/cache-pixi-lock.yml
2022 unit-test :
21- name : " py ${{ matrix.python-version }} | ${{ matrix.os }} | unit tests"
23+ name : " Unit tests: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests"
2224 runs-on : ${{ matrix.os }}-latest
25+ needs : [cache-pixi-lock]
26+ env :
27+ COVERAGE_REPORT : " ${{ matrix.os }}_${{ matrix.pixi-environment }}_unit_test_report.html"
2328 strategy :
2429 fail-fast : false
2530 matrix :
2631 os : [ubuntu] # , mac, windows] # TODO v4: Re-enable windows and mac
27- python-version : ["3.12" ]
32+ pixi-environment : [test-latest ]
2833 include :
2934 - os : ubuntu
30- python-version : " 3.11 "
35+ pixi-environment : " test-py311 "
3136 steps :
32- - name : Checkout
33- uses : actions/checkout@v4
34- - name : Setup Conda and parcels
35- uses : ./.github/actions/install-parcels
37+ - uses : actions/checkout@v4
38+ - name : Restore cached pixi lockfile
39+ uses : actions/cache/restore@v4
40+ id : restore-pixi-lock
41+ with :
42+ path : |
43+ pixi.lock
44+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
45+ -
uses :
prefix-dev/[email protected] 3646 with :
37- environment-file : environment.yml
38- python-version : ${{ matrix.python-version }}
47+ cache : true
48+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
3949 - name : Unit test
4050 run : |
41- coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html
42- coverage xml
51+ pixi run -e ${{ matrix.pixi-environment }} tests -v -s --cov=parcels --cov-report=xml --html="${{ env.COVERAGE_REPORT }}" --self-contained-html
4352 - name : Codecov
44534554 env :
@@ -50,13 +59,16 @@ jobs:
5059 if : ${{ always() }} # Always run this step, even if tests fail
5160 uses : actions/upload-artifact@v4
5261 with :
53- name : Unittest report ${{ matrix.os }}-${{ matrix.python-version }}
54- path : ${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html
62+ name : Unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
63+ path : ${{ env.COVERAGE_REPORT }}
5564 integration-test :
5665 # TODO v4: Re-enable the workflow once development has stabilized and we want to run integration tests again
5766 if : false
58- name : " py ${{ matrix.python-version }} | ${{ matrix.os }} | integration tests"
67+ name : " Integration: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests-notebooks "
5968 runs-on : ${{ matrix.os }}-latest
69+ needs : [cache-pixi-lock]
70+ env :
71+ COVERAGE_REPORT : " ${{ matrix.os }}_${{ matrix.pixi-environment }}_integration_test_report.html"
6072 strategy :
6173 fail-fast : false
6274 matrix :
@@ -66,22 +78,21 @@ jobs:
6678 - os : ubuntu
6779 python-version : " 3.11"
6880 steps :
69- - name : Checkout
70- uses : actions/checkout@v4
71- - name : Setup Conda and parcels
72- uses : ./.github/actions/install-parcels
81+ - uses : actions/checkout@v4
82+ - name : Restore cached pixi lockfile
83+ uses : actions/cache/restore@v4
84+ id : restore-pixi-lock
7385 with :
74- environment-file : environment.yml
86+ path : |
87+ pixi.lock
88+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
89+ -
uses :
prefix-dev/[email protected] 90+ with :
91+ cache : true
92+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
7593 - name : Integration test
76- # TODO v4: Re-enable `tutorial_periodic_boundaries`
77- # TODO v4: Re-enable `tutorial_timevaryingdepthdimensions`
78- # TODO v4: Re-enable `tutorial_particle_field_interaction`
79- # TODO v4: Re-enable `tutorial_croco_3D`
80- # TODO v4: Re-enable `tutorial_nemo_3D` (https://github.com/OceanParcels/Parcels/pull/1936#issuecomment-2717666705)
81- # TODO v4: Re-enable `tutorial_analyticaladvection`
8294 run : |
83- coverage run -m pytest -v -s --nbval-lax -k "not documentation and not tutorial_periodic_boundaries and not tutorial_timevaryingdepthdimensions and not tutorial_particle_field_interaction and not tutorial_croco_3D and not tutorial_nemo_3D and not tutorial_analyticaladvection" --html="${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html" --self-contained-html docs/examples
84- coverage xml
95+ pixi run test-notebooks -v -s --html="${{ env.COVERAGE_REPORT }}" --self-contained-html --cov=parcels --cov-report=xml
8596 - name : Codecov
86978798 env :
92103 if : ${{ always() }} # Always run this step, even if tests fail
93104 uses : actions/upload-artifact@v4
94105 with :
95- name : Integration test report ${{ matrix.os }}-${{ matrix.python-version }}
96- path : ${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html
106+ name : Integration test report ${{ matrix.os }}-${{ matrix.pixi-environment }}
107+ path : ${{ env.COVERAGE_REPORT }}
97108 merge-test-artifacts :
98109 runs-on : ubuntu-latest
99110 needs :
@@ -107,21 +118,28 @@ jobs:
107118 name : Testing reports
108119 pattern : " * report *"
109120 typechecking :
110- name : mypy
121+ name : " TypeChecking: pixi run typing "
111122 # TODO v4: Enable typechecking again
112123 if : false
113124 runs-on : ubuntu-latest
125+ needs : [cache-pixi-lock]
114126 steps :
115127 - name : Checkout
116128 uses : actions/checkout@v4
117- - name : Setup Conda and parcels
118- uses : ./.github/actions/install-parcels
129+ - name : Restore cached pixi lockfile
130+ uses : actions/cache/restore@v4
131+ id : restore-pixi-lock
132+ with :
133+ path : |
134+ pixi.lock
135+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
136+ -
uses :
prefix-dev/[email protected] 119137 with :
120- environment-file : environment.yml
121- - run : conda install lxml # dep for report generation
138+ cache : true
139+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
122140 - name : Typechecking
123141 run : |
124- mypy --install-types --non-interactive parcels --html-report mypy-report
142+ pixi run typing --non-interactive --html-report mypy-report
125143 - name : Upload test results
126144 if : ${{ always() }} # Upload even on mypy error
127145 uses : actions/upload-artifact@v4
0 commit comments