@@ -14,6 +14,7 @@ concurrency:
1414
1515env :
1616 FORCE_COLOR : 3
17+ PIXI_VERSION : " v0.58.0"
1718
1819jobs :
1920 detect-ci-trigger :
@@ -32,19 +33,21 @@ jobs:
3233 id : detect-trigger
3334 with :
3435 keyword : " [skip-ci]"
35-
36+ cache-pixi-lock :
37+ uses : ./.github/workflows/cache-pixi-lock.yml
38+ with :
39+ pixi-version : " v0.58.0" # keep in sync with env var above
3640 doctest :
3741 name : Doctests
3842 runs-on : " ubuntu-latest"
39- needs : detect-ci-trigger
43+ needs : [ detect-ci-trigger, cache-pixi-lock]
4044 if : needs.detect-ci-trigger.outputs.triggered == 'false'
4145
4246 defaults :
4347 run :
4448 shell : bash -l {0}
4549 env :
46- CONDA_ENV_FILE : ci/requirements/environment.yml
47- PYTHON_VERSION : " 3.12"
50+ PIXI_ENV : test-all-deps-py313
4851 steps :
4952 - uses : actions/checkout@v5
5053 with :
@@ -54,22 +57,24 @@ jobs:
5457 run : |
5558 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
5659
57- - name : Setup micromamba
58- uses : mamba-org/setup-micromamba@v2
60+ - name : Restore cached pixi lockfile
61+ uses : actions/cache/restore@v4
62+ id : restore-pixi-lock
5963 with :
60- environment-file : ${{env.CONDA_ENV_FILE}}
61- environment-name : xarray-tests
62- create-args : >-
63- python=${{env.PYTHON_VERSION}}
64- cache-environment : true
65- cache-environment-key : " ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
64+ enableCrossOsArchive : true
65+ path : |
66+ pixi.lock
67+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
68+ -
uses :
prefix-dev/[email protected] 69+ with :
70+ pixi-version : ${{ env.PIXI_VERSION }}
71+ cache : true
72+ environments : ${{ env.PIXI_ENV }}
73+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
6674
67- - name : Install xarray
68- run : |
69- python -m pip install --no-deps -e .
7075 - name : Version info
7176 run : |
72- python xarray/util/print_versions.py
77+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
7378 - name : Run doctests
7479 run : |
7580 # Raise an error if there are warnings in the doctests, with `-Werror`.
@@ -78,49 +83,47 @@ jobs:
7883 #
7984 # If dependencies emit warnings we can't do anything about, add ignores to
8085 # `xarray/tests/__init__.py`.
81- python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
86+ pixi run -e ${{env.PIXI_ENV}} python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
8287
8388 mypy :
8489 name : Mypy
8590 runs-on : " ubuntu-latest"
86- needs : detect-ci-trigger
91+ needs : [ detect-ci-trigger, cache-pixi-lock]
8792 defaults :
8893 run :
8994 shell : bash -l {0}
9095 env :
91- CONDA_ENV_FILE : ci/requirements/environment.yml
92- PYTHON_VERSION : " 3.12"
96+ PIXI_ENV : test-all-mypy-py313
9397
9498 steps :
9599 - uses : actions/checkout@v5
96100 with :
97101 fetch-depth : 0 # Fetch all history for all branches and tags.
98-
102+ - name : Restore cached pixi lockfile
103+ uses : actions/cache/restore@v4
104+ id : restore-pixi-lock
105+ with :
106+ enableCrossOsArchive : true
107+ path : |
108+ pixi.lock
109+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
110+ -
uses :
prefix-dev/[email protected] 111+ with :
112+ pixi-version : ${{ env.PIXI_VERSION }}
113+ cache : true
114+ environments : ${{ env.PIXI_ENV }}
115+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
99116 - name : set environment variables
100117 run : |
101118 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
102- - name : Setup micromamba
103- uses : mamba-org/setup-micromamba@v2
104- with :
105- environment-file : ${{env.CONDA_ENV_FILE}}
106- environment-name : xarray-tests
107- create-args : >-
108- python=${{env.PYTHON_VERSION}}
109- cache-environment : true
110- cache-environment-key : " ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
111- - name : Install xarray
112- run : |
113- python -m pip install --no-deps -e .
119+ echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
114120 - name : Version info
115121 run : |
116- python xarray/util/print_versions.py
117- - name : Install mypy
118- run : |
119- python -m pip install "mypy==1.18.1" --force-reinstall
122+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
120123
121124 - name : Run mypy
122125 run : |
123- python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
126+ pixi run -e ${{env.PIXI_ENV}} python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
124127
125128 - name : Upload mypy coverage to Codecov
126129@@ -134,44 +137,42 @@ jobs:
134137 mypy-min :
135138 name : Mypy 3.11
136139 runs-on : " ubuntu-latest"
137- needs : detect-ci-trigger
140+ needs : [ detect-ci-trigger, cache-pixi-lock]
138141 defaults :
139142 run :
140143 shell : bash -l {0}
141144 env :
142- CONDA_ENV_FILE : ci/requirements/environment.yml
143- PYTHON_VERSION : " 3.11"
145+ PIXI_ENV : test-all-mypy-py311
144146
145147 steps :
146148 - uses : actions/checkout@v5
147149 with :
148150 fetch-depth : 0 # Fetch all history for all branches and tags.
149-
151+ - name : Restore cached pixi lockfile
152+ uses : actions/cache/restore@v4
153+ id : restore-pixi-lock
154+ with :
155+ enableCrossOsArchive : true
156+ path : |
157+ pixi.lock
158+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
159+ -
uses :
prefix-dev/[email protected] 160+ with :
161+ pixi-version : ${{ env.PIXI_VERSION }}
162+ cache : true
163+ environments : ${{ env.PIXI_ENV }}
164+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
150165 - name : set environment variables
151166 run : |
152167 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
153- - name : Setup micromamba
154- uses : mamba-org/setup-micromamba@v2
155- with :
156- environment-file : ${{env.CONDA_ENV_FILE}}
157- environment-name : xarray-tests
158- create-args : >-
159- python=${{env.PYTHON_VERSION}}
160- cache-environment : true
161- cache-environment-key : " ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
162- - name : Install xarray
163- run : |
164- python -m pip install --no-deps -e .
168+ echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
165169 - name : Version info
166170 run : |
167- python xarray/util/print_versions.py
168- - name : Install mypy
169- run : |
170- python -m pip install "mypy==1.18.1" --force-reinstall
171+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
171172
172173 - name : Run mypy
173174 run : |
174- python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
175+ pixi run -e ${{env.PIXI_ENV}} python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
175176
176177 - name : Upload mypy coverage to Codecov
177178@@ -185,7 +186,7 @@ jobs:
185186 pyright :
186187 name : Pyright
187188 runs-on : " ubuntu-latest"
188- needs : detect-ci-trigger
189+ needs : [ detect-ci-trigger, cache-pixi-lock]
189190 if : |
190191 always()
191192 && (
@@ -195,39 +196,41 @@ jobs:
195196 run :
196197 shell : bash -l {0}
197198 env :
198- CONDA_ENV_FILE : ci/requirements/environment.yml
199- PYTHON_VERSION : " 3.12"
199+ PIXI_ENV : test-all-deps-py313
200200
201201 steps :
202202 - uses : actions/checkout@v5
203203 with :
204204 fetch-depth : 0 # Fetch all history for all branches and tags.
205205
206+ - name : Restore cached pixi lockfile
207+ uses : actions/cache/restore@v4
208+ id : restore-pixi-lock
209+ with :
210+ enableCrossOsArchive : true
211+ path : |
212+ pixi.lock
213+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
214+ -
uses :
prefix-dev/[email protected] 215+ with :
216+ pixi-version : ${{ env.PIXI_VERSION }}
217+ cache : true
218+ environments : ${{ env.PIXI_ENV }}
219+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
206220 - name : set environment variables
207221 run : |
208222 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
209- - name : Setup micromamba
210- uses : mamba-org/setup-micromamba@v2
211- with :
212- environment-file : ${{env.CONDA_ENV_FILE}}
213- environment-name : xarray-tests
214- create-args : >-
215- python=${{env.PYTHON_VERSION}}
216- cache-environment : true
217- cache-environment-key : " ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
218- - name : Install xarray
219- run : |
220- python -m pip install --no-deps -e .
223+ echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
221224 - name : Version info
222225 run : |
223- python xarray/util/print_versions.py
226+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
224227 - name : Install pyright
225228 run : |
226- python -m pip install pyright --force-reinstall
229+ pixi add -e ${{env.PIXI_ENV}} --pypi pyright
227230
228231 - name : Run pyright
229232 run : |
230- python -m pyright xarray/
233+ pixi run -e ${{env.PIXI_ENV}} python -m pyright xarray/
231234
232235 - name : Upload pyright coverage to Codecov
233236@@ -241,7 +244,7 @@ jobs:
241244 pyright39 :
242245 name : Pyright 3.11
243246 runs-on : " ubuntu-latest"
244- needs : detect-ci-trigger
247+ needs : [ detect-ci-trigger, cache-pixi-lock]
245248 if : |
246249 always()
247250 && (
@@ -251,39 +254,40 @@ jobs:
251254 run :
252255 shell : bash -l {0}
253256 env :
254- CONDA_ENV_FILE : ci/requirements/environment.yml
255- PYTHON_VERSION : " 3.11"
257+ PIXI_ENV : test-all-deps-py313
256258
257259 steps :
258260 - uses : actions/checkout@v5
259261 with :
260262 fetch-depth : 0 # Fetch all history for all branches and tags.
261-
263+ - name : Restore cached pixi lockfile
264+ uses : actions/cache/restore@v4
265+ id : restore-pixi-lock
266+ with :
267+ enableCrossOsArchive : true
268+ path : |
269+ pixi.lock
270+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
271+ -
uses :
prefix-dev/[email protected] 272+ with :
273+ pixi-version : ${{ env.PIXI_VERSION }}
274+ cache : true
275+ environments : ${{ env.PIXI_ENV }}
276+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
262277 - name : set environment variables
263278 run : |
264279 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
265- - name : Setup micromamba
266- uses : mamba-org/setup-micromamba@v2
267- with :
268- environment-file : ${{env.CONDA_ENV_FILE}}
269- environment-name : xarray-tests
270- create-args : >-
271- python=${{env.PYTHON_VERSION}}
272- cache-environment : true
273- cache-environment-key : " ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
274- - name : Install xarray
275- run : |
276- python -m pip install --no-deps -e .
280+ echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV
277281 - name : Version info
278282 run : |
279- python xarray/util/print_versions.py
283+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
280284 - name : Install pyright
281285 run : |
282- python -m pip install pyright --force-reinstall
286+ pixi add -e ${{env.PIXI_ENV}} --pypi pyright
283287
284288 - name : Run pyright
285289 run : |
286- python -m pyright xarray/
290+ pixi run -e ${{env.PIXI_ENV}} python -m pyright xarray/
287291
288292 - name : Upload pyright coverage to Codecov
289293
0 commit comments