Skip to content

Commit e236a0a

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

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

.github/workflows/run-tests.yaml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ jobs:
1010
strategy:
1111
matrix:
1212
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"]
13+
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "=3.9[build=*_pypy]"]
14+
15+
name: Python ${{ matrix.python-version }}
16+
runs-on: ubuntu-latest
1417
include:
1518
- os: ubuntu-latest
1619
os-name: Linux
@@ -26,15 +29,19 @@ jobs:
2629

2730
# Setup Python/pip
2831
- uses: actions/checkout@v4
29-
- uses: s-weigand/setup-conda@v1
32+
- uses: conda-incubator/setup-miniconda@v3
3033
with:
31-
conda-channels: conda-forge
34+
miniforge-version: latest
3235
python-version: ${{ matrix.python-version }}
3336
if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
3437
- uses: actions/setup-python@v4
3538
with:
3639
python-version: ${{ matrix.python-version }}
3740
if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }}
41+
- uses: actions/cache@v3
42+
with:
43+
path: ~/conda_pkgs_dir
44+
key: ${{ runner.os }}-conda
3845
- name: Cache pip
3946
uses: actions/cache@v3
4047
with:
@@ -49,29 +56,32 @@ jobs:
4956
python -m pip install --upgrade pip setuptools wheel
5057
pip --version
5158
pip install --upgrade virtualenv "tox >= 3.15, < 4"
59+
shell: ${{ runner.os = 'Windows' && 'cmd /C call {0}' || 'bash -el {0}' }}
5260
- name: Set TOXENV
5361
run: |
62+
python -c "
5463
import os, sys
5564
ld_library_path = None
5665
if hasattr(sys, 'pypy_version_info'):
57-
toxenv = 'pypy3'
66+
toxenv = 'pypy3'
5867
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
68+
pyver = '%d%d' % tuple(sys.version_info[:2])
69+
if (pyver == '27') and (os.name == 'posix'): # Python 2.7 on Linux requires `$LD_LIBRARY_PATH`
70+
ld_library_path = os.path.join(
71+
os.path.dirname(os.path.dirname(sys.executable)), 'lib')
72+
toxenv = 'py%s' % pyver
73+
if os.name == 'posix':
74+
toxenv += ',py%s-flake8' % pyver
6775
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
76+
if ld_library_path:
77+
f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
78+
f.write('TOXENV=' + toxenv + '\n')
79+
"
80+
shell: ${{ runner.os = 'Windows' && 'cmd /C call {0}' || 'bash -el {0}' }}
7281

7382
- name: Run tox
7483
run: |
7584
python -c "import os; print(os.environ['TOXENV'])"
7685
tox --version
7786
tox
87+
shell: ${{ runner.os = 'Windows' && 'cmd /C call {0}' || 'bash -el {0}' }}

0 commit comments

Comments
 (0)