@@ -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/setup-pixi@v0.9.0
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`.
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
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
@@ -99,35 +103,34 @@ jobs:
99103 - name : set environment variables
100104 run : |
101105 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
102- - name : Setup micromamba
103- uses : mamba-org/setup-micromamba@v2
106+ - name : Restore cached pixi lockfile
107+ uses : actions/cache/restore@v4
108+ id : restore-pixi-lock
104109 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 .
110+ enableCrossOsArchive : true
111+ path : |
112+ pixi.lock
113+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
114+ - uses : prefix-dev/setup-pixi@v0.9.0
115+ with :
116+ pixi-version : ${{ env.PIXI_VERSION }}
117+ cache : true
118+ environments : ${{ env.PIXI_ENV }}
119+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
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 uses : codecov/codecov-action@v5.5.1
127130 with :
128131 file : mypy_report/cobertura.xml
129132 flags : mypy
130- env_vars : PYTHON_VERSION
133+ # env_vars: PYTHON_VERSION
131134 name : codecov-umbrella
132135 fail_ci_if_error : false
133136
@@ -139,8 +142,7 @@ jobs:
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
@@ -150,35 +152,34 @@ jobs:
150152 - name : set environment variables
151153 run : |
152154 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
153- - name : Setup micromamba
154- uses : mamba-org/setup-micromamba@v2
155+ - name : Restore cached pixi lockfile
156+ uses : actions/cache/restore@v4
157+ id : restore-pixi-lock
155158 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 .
159+ enableCrossOsArchive : true
160+ path : |
161+ pixi.lock
162+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
163+ - uses : prefix-dev/setup-pixi@v0.9.0
164+ with :
165+ pixi-version : ${{ env.PIXI_VERSION }}
166+ cache : true
167+ environments : ${{ env.PIXI_ENV }}
168+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
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 uses : codecov/codecov-action@v5.5.1
178179 with :
179180 file : mypy_report/cobertura.xml
180181 flags : mypy-min
181- env_vars : PYTHON_VERSION
182+ # env_vars: PYTHON_VERSION
182183 name : codecov-umbrella
183184 fail_ci_if_error : false
184185
@@ -195,8 +196,7 @@ 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
@@ -215,26 +215,23 @@ jobs:
215215 python=${{env.PYTHON_VERSION}}
216216 cache-environment : true
217217 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 .
221218 - name : Version info
222219 run : |
223- python xarray/util/print_versions.py
220+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
224221 - name : Install pyright
225222 run : |
226- python -m pip install pyright --force-reinstall
223+ pixi add -e ${{env.PIXI_ENV}} --pypi pyright
227224
228225 - name : Run pyright
229226 run : |
230- python -m pyright xarray/
227+ pixi run -e ${{env.PIXI_ENV}} python -m pyright xarray/
231228
232229 - name : Upload pyright coverage to Codecov
233230 uses : codecov/codecov-action@v5.5.1
234231 with :
235232 file : pyright_report/cobertura.xml
236233 flags : pyright
237- env_vars : PYTHON_VERSION
234+ # env_vars: PYTHON_VERSION
238235 name : codecov-umbrella
239236 fail_ci_if_error : false
240237
@@ -251,8 +248,7 @@ jobs:
251248 run :
252249 shell : bash -l {0}
253250 env :
254- CONDA_ENV_FILE : ci/requirements/environment.yml
255- PYTHON_VERSION : " 3.11"
251+ PIXI_ENV : test-all-deps-py313
256252
257253 steps :
258254 - uses : actions/checkout@v5
@@ -262,35 +258,37 @@ jobs:
262258 - name : set environment variables
263259 run : |
264260 echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
265- - name : Setup micromamba
266- uses : mamba-org/setup-micromamba@v2
261+ - name : Restore cached pixi lockfile
262+ uses : actions/cache/restore@v4
263+ id : restore-pixi-lock
267264 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 .
265+ enableCrossOsArchive : true
266+ path : |
267+ pixi.lock
268+ key : ${{ needs.cache-pixi-lock.outputs.cache-id }}
269+ - uses : prefix-dev/setup-pixi@v0.9.0
270+ with :
271+ pixi-version : ${{ env.PIXI_VERSION }}
272+ cache : true
273+ environments : ${{ env.PIXI_ENV }}
274+ cache-write : ${{ github.event_name == 'push' && github.ref_name == 'main' }}
277275 - name : Version info
278276 run : |
279- python xarray/util/print_versions.py
277+ pixi run -e ${{env.PIXI_ENV}} python xarray/util/print_versions.py
280278 - name : Install pyright
281279 run : |
282- python -m pip install pyright --force-reinstall
280+ pixi add -e ${{env.PIXI_ENV}} --pypi pyright
283281
284282 - name : Run pyright
285283 run : |
286- python -m pyright xarray/
284+ pixi run -e ${{env.PIXI_ENV}} python -m pyright xarray/
287285
288286 - name : Upload pyright coverage to Codecov
289287 uses : codecov/codecov-action@v5.5.1
290288 with :
291289 file : pyright_report/cobertura.xml
292290 flags : pyright39
293- env_vars : PYTHON_VERSION
291+ # env_vars: PYTHON_VERSION
294292 name : codecov-umbrella
295293 fail_ci_if_error : false
296294
0 commit comments