Skip to content

Commit d7e2ce1

Browse files
committed
Switch to setup-micromamba action
1 parent 5205111 commit d7e2ce1

File tree

2 files changed

+49
-203
lines changed

2 files changed

+49
-203
lines changed

.github/workflows/mypy.yml

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,27 @@ on:
55
push:
66
branches: [main]
77

8+
defaults:
9+
run:
10+
shell: bash -leo pipefail {0}
811
jobs:
912
mypy:
1013
runs-on: ubuntu-latest
11-
defaults:
12-
run:
13-
shell: bash -l {0}
1414
steps:
1515
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
16-
- name: Cache conda
17-
uses: actions/cache@v4
18-
env:
19-
# Increase this value to reset cache if environment-test.yml has not changed
20-
CACHE_NUMBER: 0
16+
- uses: mamba-org/setup-micromamba@v2
2117
with:
22-
path: ~/conda_pkgs_dir
23-
key: ${{ runner.os }}-py39-conda-${{ env.CACHE_NUMBER }}-${{
24-
hashFiles('conda-envs/environment-test.yml') }}
25-
- name: Cache multiple paths
26-
uses: actions/cache@v4
27-
env:
28-
# Increase this value to reset cache if requirements.txt has not changed
29-
CACHE_NUMBER: 0
30-
with:
31-
path: |
32-
~/.cache/pip
33-
$RUNNER_TOOL_CACHE/Python/*
34-
~\AppData\Local\pip\Cache
35-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
36-
hashFiles('requirements.txt') }}
37-
- uses: conda-incubator/setup-miniconda@v2
38-
with:
39-
miniforge-variant: Mambaforge
40-
miniforge-version: latest
41-
mamba-version: "*"
42-
activate-environment: pymc-test
43-
channel-priority: strict
4418
environment-file: conda-envs/environment-test.yml
45-
python-version: "3.10" # Run pre-commit on oldest supported Python version
46-
use-mamba: true
47-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
19+
create-args: >-
20+
python=3.10
21+
environment-name: pymc-test
22+
init-shell: bash
23+
cache-environment: true
4824
- name: Install-pymc and mypy dependencies
4925
run: |
50-
conda activate pymc-test
5126
pip install -e .
5227
pip install --pre -U polyagamma
5328
python --version
5429
- name: Run mypy
5530
run: |
56-
conda activate pymc-test
5731
python ./scripts/run_mypy.py --verbose

.github/workflows/tests.yml

Lines changed: 40 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -140,52 +140,26 @@ jobs:
140140
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
141141
defaults:
142142
run:
143-
shell: bash -l {0}
143+
shell: bash -leo pipefail {0}
144144
steps:
145145
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
146-
- name: Cache conda
147-
uses: actions/cache@v4
148-
env:
149-
# Increase this value to reset cache if environment-test.yml has not changed
150-
CACHE_NUMBER: 0
146+
- uses: mamba-org/setup-micromamba@v2
151147
with:
152-
path: ~/conda_pkgs_dir
153-
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
154-
hashFiles('conda-envs/environment-test.yml') }}
155-
- name: Cache multiple paths
156-
uses: actions/cache@v4
157-
env:
158-
# Increase this value to reset cache if requirements.txt has not changed
159-
CACHE_NUMBER: 0
160-
with:
161-
path: |
162-
~/.cache/pip
163-
$RUNNER_TOOL_CACHE/Python/*
164-
~\AppData\Local\pip\Cache
165-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
166-
hashFiles('requirements.txt') }}
167-
- uses: conda-incubator/setup-miniconda@v2
168-
with:
169-
miniforge-variant: Mambaforge
170-
miniforge-version: latest
171-
mamba-version: "*"
172-
activate-environment: pymc-test
173-
channel-priority: strict
174148
environment-file: conda-envs/environment-test.yml
175-
python-version: ${{matrix.python-version}}
176-
use-mamba: true
177-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
149+
create-args: >-
150+
python=${{matrix.python-version}}
151+
environment-name: pymc-test
152+
init-shell: bash
153+
cache-environment: true
178154
- name: Install-pymc
179155
run: |
180-
conda activate pymc-test
181156
pip install -e .
182157
# TODO: https://github.com/pymc-devs/pymc/issues/7417
183158
pip install --pre -U 'polyagamma<1.3.7'
184159
python --version
185-
conda list
160+
micromamba list
186161
- name: Run tests
187162
run: |
188-
conda activate pymc-test
189163
python -m pytest -vv --cov=pymc --cov-report=xml --no-cov-on-fail --cov-report term --durations=50 $TEST_SUBSET
190164
- name: Upload coverage to Codecov
191165
uses: codecov/codecov-action@v4
@@ -216,53 +190,27 @@ jobs:
216190
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
217191
defaults:
218192
run:
219-
shell: cmd
193+
shell: cmd /C call {0}
220194
steps:
221195
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
222-
- name: Cache conda
223-
uses: actions/cache@v4
224-
env:
225-
# Increase this value to reset cache if conda-envs/windows-environment-test.yml has not changed
226-
CACHE_NUMBER: 0
227-
with:
228-
path: ~/conda_pkgs_dir
229-
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
230-
hashFiles('conda-envs/windows-environment-test.yml') }}
231-
- name: Cache multiple paths
232-
uses: actions/cache@v4
233-
env:
234-
# Increase this value to reset cache if requirements.txt has not changed
235-
CACHE_NUMBER: 0
196+
- uses: mamba-org/setup-micromamba@v2
236197
with:
237-
path: |
238-
~/.cache/pip
239-
$RUNNER_TOOL_CACHE/Python/*
240-
~\AppData\Local\pip\Cache
241-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
242-
hashFiles('requirements.txt') }}
243-
- uses: conda-incubator/setup-miniconda@v2
244-
with:
245-
miniforge-variant: Mambaforge
246-
miniforge-version: latest
247-
mamba-version: "*"
248-
activate-environment: pymc-test
249-
channel-priority: strict
250198
environment-file: conda-envs/windows-environment-test.yml
251-
python-version: ${{matrix.python-version}}
252-
use-mamba: true
253-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
199+
create-args: >-
200+
python=${{matrix.python-version}}
201+
environment-name: pymc-test
202+
init-shell: cmd.exe
203+
cache-environment: true
254204
- name: Install-pymc
255205
run: |
256-
conda activate pymc-test
257206
pip install -e .
258207
pip install --pre -U 'polyagamma<1.3.7'
259208
python --version
260-
conda list
209+
micromamba list
261210
- name: Run tests
262211
# This job uses a cmd shell, therefore the environment variable syntax is different!
263212
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682).
264213
run: >-
265-
conda activate pymc-test &&
266214
python -m pytest -vv --cov=pymc --cov-report=xml --no-cov-on-fail --cov-report term --durations=50 %TEST_SUBSET%
267215
- name: Upload coverage to Codecov
268216
uses: codecov/codecov-action@v4
@@ -300,47 +248,22 @@ jobs:
300248
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
301249
defaults:
302250
run:
303-
shell: bash -l {0}
251+
shell: bash -leo pipefail {0}
304252
steps:
305253
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
306-
- name: Cache conda
307-
uses: actions/cache@v4
308-
env:
309-
# Increase this value to reset cache if environment-test.yml has not changed
310-
CACHE_NUMBER: 0
311-
with:
312-
path: ~/conda_pkgs_dir
313-
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
314-
hashFiles('conda-envs/environment-test.yml') }}
315-
- name: Cache multiple paths
316-
uses: actions/cache@v4
317-
env:
318-
# Increase this value to reset cache if requirements.txt has not changed
319-
CACHE_NUMBER: 0
254+
- uses: mamba-org/setup-micromamba@v2
320255
with:
321-
path: |
322-
~/.cache/pip
323-
$RUNNER_TOOL_CACHE/Python/*
324-
~\AppData\Local\pip\Cache
325-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
326-
hashFiles('requirements.txt') }}
327-
- uses: conda-incubator/setup-miniconda@v2
328-
with:
329-
miniforge-variant: Mambaforge
330-
miniforge-version: latest
331-
mamba-version: "*"
332-
activate-environment: pymc-test
333-
channel-priority: strict
334256
environment-file: conda-envs/environment-test.yml
335-
python-version: ${{matrix.python-version}}
336-
use-mamba: true
337-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
257+
create-args: >-
258+
python=${{matrix.python-version}}
259+
environment-name: pymc-test
260+
init-shell: bash
261+
cache-environment: true
338262
- name: Install pymc
339263
run: |
340-
conda activate pymc-test
341264
pip install -e .
342265
python --version
343-
conda list
266+
micromamba list
344267
- name: Run tests
345268
run: |
346269
python -m pytest -vv --cov=pymc --cov-report=xml --no-cov-on-fail --cov-report term --durations=50 $TEST_SUBSET
@@ -369,47 +292,22 @@ jobs:
369292
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=native'
370293
defaults:
371294
run:
372-
shell: bash -l {0}
295+
shell: bash -leo pipefail {0}
373296
steps:
374297
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
375-
- name: Cache conda
376-
uses: actions/cache@v4
377-
env:
378-
# Increase this value to reset cache if environment-jax.yml has not changed
379-
CACHE_NUMBER: 0
380-
with:
381-
path: ~/conda_pkgs_dir
382-
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
383-
hashFiles('conda-envs/environment-jax.yml') }}
384-
- name: Cache multiple paths
385-
uses: actions/cache@v4
386-
env:
387-
# Increase this value to reset cache if requirements.txt has not changed
388-
CACHE_NUMBER: 0
389-
with:
390-
path: |
391-
~/.cache/pip
392-
$RUNNER_TOOL_CACHE/Python/*
393-
~\AppData\Local\pip\Cache
394-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
395-
hashFiles('requirements.txt') }}
396-
- uses: conda-incubator/setup-miniconda@v2
298+
- uses: mamba-org/setup-micromamba@v2
397299
with:
398-
miniforge-variant: Mambaforge
399-
miniforge-version: latest
400-
mamba-version: "*"
401-
activate-environment: pymc-test
402-
channel-priority: strict
403300
environment-file: conda-envs/environment-jax.yml
404-
python-version: ${{matrix.python-version}}
405-
use-mamba: true
406-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
301+
create-args: >-
302+
python=${{matrix.python-version}}
303+
environment-name: pymc-test
304+
init-shell: bash
305+
cache-environment: true
407306
- name: Install pymc
408307
run: |
409-
conda activate pymc-test
410308
pip install -e .
411309
python --version
412-
conda list
310+
micromamba list
413311
- name: Run tests
414312
run: |
415313
python -m pytest -vv --cov=pymc --cov-report=xml --no-cov-on-fail --cov-report term --durations=50 $TEST_SUBSET
@@ -438,53 +336,27 @@ jobs:
438336
PYTENSOR_FLAGS: floatX=${{ matrix.floatx }},gcc__cxxflags='-march=core2'
439337
defaults:
440338
run:
441-
shell: cmd
339+
shell: cmd /C call {0}
442340
steps:
443341
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
444-
- name: Cache conda
445-
uses: actions/cache@v4
446-
env:
447-
# Increase this value to reset cache if conda-envs/windows-environment-test.yml has not changed
448-
CACHE_NUMBER: 0
449-
with:
450-
path: ~/conda_pkgs_dir
451-
key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{
452-
hashFiles('conda-envs/windows-environment-test.yml') }}
453-
- name: Cache multiple paths
454-
uses: actions/cache@v4
455-
env:
456-
# Increase this value to reset cache if requirements.txt has not changed
457-
CACHE_NUMBER: 0
458-
with:
459-
path: |
460-
~/.cache/pip
461-
$RUNNER_TOOL_CACHE/Python/*
462-
~\AppData\Local\pip\Cache
463-
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{
464-
hashFiles('requirements.txt') }}
465-
- uses: conda-incubator/setup-miniconda@v2
342+
- uses: mamba-org/setup-micromamba@v2
466343
with:
467-
miniforge-variant: Mambaforge
468-
miniforge-version: latest
469-
mamba-version: "*"
470-
activate-environment: pymc-test
471-
channel-priority: strict
472344
environment-file: conda-envs/windows-environment-test.yml
473-
python-version: ${{matrix.python-version}}
474-
use-mamba: true
475-
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
345+
create-args: >-
346+
python=${{matrix.python-version}}
347+
environment-name: pymc-test
348+
init-shell: cmd.exe
349+
cache-environment: true
476350
- name: Install-pymc
477351
run: |
478-
conda activate pymc-test
479352
pip install -e .
480353
pip install --pre -U 'polyagamma<1.3.7'
481354
python --version
482-
conda list
355+
micromamba list
483356
- name: Run tests
484357
# This job uses a cmd shell, therefore the environment variable syntax is different!
485358
# The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682).
486359
run: >-
487-
conda activate pymc-test &&
488360
python -m pytest -vv --cov=pymc --cov-report=xml --no-cov-on-fail --cov-report term --durations=50 %TEST_SUBSET%
489361
- name: Upload coverage to Codecov
490362
uses: codecov/codecov-action@v4

0 commit comments

Comments
 (0)