Skip to content

Commit f0608a8

Browse files
committed
CI(GHActions): Switch to setup-miniconda
1 parent 1c8100c commit f0608a8

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

.github/workflows/run-tests.yaml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Run tests
22

33
on: [push, pull_request]
44

5+
defaults:
6+
run:
7+
shell: ${{ matrix.os-name == 'w32' && 'cmd /C call {0}' || 'bash -el {0}' }}
8+
59
jobs:
610
run-tests:
711
env:
@@ -10,7 +14,8 @@ jobs:
1014
strategy:
1115
matrix:
1216
os: [ubuntu-latest, windows-latest]
13-
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.7"]
17+
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "=3.9[build=*_pypy]"]
18+
1419
include:
1520
- os: ubuntu-latest
1621
os-name: Linux
@@ -26,15 +31,19 @@ jobs:
2631

2732
# Setup Python/pip
2833
- uses: actions/checkout@v4
29-
- uses: s-weigand/setup-conda@v1
34+
- uses: conda-incubator/setup-miniconda@v3
3035
with:
31-
conda-channels: conda-forge
36+
miniforge-version: latest
3237
python-version: ${{ matrix.python-version }}
3338
if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
3439
- uses: actions/setup-python@v4
3540
with:
3641
python-version: ${{ matrix.python-version }}
3742
if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }}
43+
- uses: actions/cache@v3
44+
with:
45+
path: ~/conda_pkgs_dir
46+
key: ${{ runner.os }}-conda
3847
- name: Cache pip
3948
uses: actions/cache@v3
4049
with:
@@ -51,24 +60,24 @@ jobs:
5160
pip install --upgrade virtualenv "tox >= 3.15, < 4"
5261
- name: Set TOXENV
5362
run: |
63+
python -c "
5464
import os, sys
5565
ld_library_path = None
5666
if hasattr(sys, 'pypy_version_info'):
57-
toxenv = 'pypy3'
67+
toxenv = 'pypy3'
5868
else:
59-
pyver = '%d%d' % tuple(sys.version_info[:2])
60-
if os.name == 'posix':
61-
if pyver == '27': # Python 2.7 on Linux requires `$LD_LIBRARY_PATH`
62-
ld_library_path = os.path.join(
63-
os.path.dirname(os.path.dirname(sys.executable)), 'lib')
64-
toxenv = 'py%s' % pyver
65-
if os.name == 'posix':
66-
toxenv += ',py%s-flake8' % pyver
69+
pyver = '%d%d' % tuple(sys.version_info[:2])
70+
if (pyver == '27') and (os.name == 'posix'): # Python 2.7 on Linux requires `$LD_LIBRARY_PATH`
71+
ld_library_path = os.path.join(
72+
os.path.dirname(os.path.dirname(sys.executable)), 'lib')
73+
toxenv = 'py%s' % pyver
74+
if os.name == 'posix':
75+
toxenv += ',py%s-flake8' % pyver
6776
with open(os.environ['GITHUB_ENV'], 'a') as f:
68-
if ld_library_path:
69-
f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
70-
f.write('TOXENV=' + toxenv + '\n')
71-
shell: python
77+
if ld_library_path:
78+
f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
79+
f.write('TOXENV=' + toxenv + '\n')
80+
"
7281
7382
- name: Run tox
7483
run: |

0 commit comments

Comments
 (0)