@@ -126,6 +126,66 @@ jobs:
126126 with :
127127 name : Unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
128128 path : ${{ env.COVERAGE_REPORT }}
129+ flaky-unit-test :
130+ name : " Flaky unit tests: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests -m 'flaky'"
131+ runs-on : ${{ matrix.os }}-latest
132+ needs : [cache-pixi-lock]
133+ permissions :
134+ contents : read
135+ env :
136+ COVERAGE_REPORT : " ${{ matrix.os }}_${{ matrix.pixi-environment }}_unit_test_report.html"
137+ strategy :
138+ fail-fast : false
139+ matrix :
140+ os : [ubuntu]
141+ pixi-environment : [test]
142+ steps :
143+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
144+ with :
145+ persist-credentials : false
146+ - name : Restore cached pixi lockfile
147+ uses : Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
148+ with :
149+ cache-key : ${{ needs.cache-pixi-lock.outputs.cache-key }}
150+ - uses : prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # v0.9.0
151+ with :
152+ pixi-version : ${{ needs.cache-pixi-lock.outputs.pixi-version }}
153+ locked : false # TODO: Remove once v7 of the lock file is removed, or once we stop having external source dependencies https://github.com/Parcels-code/Parcels/pull/2550#issuecomment-4088660238
154+ cache : true
155+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
156+ # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
157+ - name : Restore cached hypothesis directory
158+ id : restore-hypothesis-cache
159+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
160+ with :
161+ path : .hypothesis/
162+ key : cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
163+ restore-keys : |
164+ cache-hypothesis-${{ runner.os }}-
165+ - name : Unit test
166+ id : unit-test
167+ run : |
168+ pixi run -e ${{ matrix.pixi-environment }} tests -m 'flaky' -v -s --cov=parcels --cov-report=xml --html="${COVERAGE_REPORT}" --self-contained-html
169+ # explicitly save the cache so it gets updated, also do this even if it fails.
170+ - name : Save cached hypothesis directory
171+ id : save-hypothesis-cache
172+ if : always() && steps.unit-test.outcome != 'skipped'
173+ uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
174+ with :
175+ path : .hypothesis/
176+ key : cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
177+ - name : Codecov
178+ uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
179+ env :
180+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }} # zizmor: ignore[secrets-outside-env]
181+ with :
182+ flags : unit-tests
183+ - name : Upload test results
184+ if : ${{ always() }} # Always run this step, even if tests fail
185+ uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
186+ with :
187+ name : Flaky unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
188+ path : ${{ env.COVERAGE_REPORT }}
129189 integration-test :
130190 name : " Integration: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests-notebooks"
131191 runs-on : ${{ matrix.os }}-latest
0 commit comments