Skip to content

Commit b37b474

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

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
@@ -6,11 +6,13 @@ jobs:
66
run-tests:
77
env:
88
not_in_conda: "[]"
9+
SHELL: ${{ matrix.os-name == 'w32' && 'cmd /C call {0}' || 'bash -el {0}' }}
910

1011
strategy:
1112
matrix:
1213
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"]
14+
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "=3.9[build=*_pypy]"]
15+
1416
include:
1517
- os: ubuntu-latest
1618
os-name: Linux
@@ -26,15 +28,19 @@ jobs:
2628

2729
# Setup Python/pip
2830
- uses: actions/checkout@v4
29-
- uses: s-weigand/setup-conda@v1
31+
- uses: conda-incubator/setup-miniconda@v3
3032
with:
31-
conda-channels: conda-forge
33+
miniforge-version: latest
3234
python-version: ${{ matrix.python-version }}
3335
if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
3436
- uses: actions/setup-python@v4
3537
with:
3638
python-version: ${{ matrix.python-version }}
3739
if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }}
40+
- uses: actions/cache@v3
41+
with:
42+
path: ~/conda_pkgs_dir
43+
key: ${{ runner.os }}-conda
3844
- name: Cache pip
3945
uses: actions/cache@v3
4046
with:
@@ -49,29 +55,32 @@ jobs:
4955
python -m pip install --upgrade pip setuptools wheel
5056
pip --version
5157
pip install --upgrade virtualenv "tox >= 3.15, < 4"
58+
shell: ${{ env.SHELL }}
5259
- name: Set TOXENV
5360
run: |
61+
python -c "
5462
import os, sys
5563
ld_library_path = None
5664
if hasattr(sys, 'pypy_version_info'):
57-
toxenv = 'pypy3'
65+
toxenv = 'pypy3'
5866
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
67+
pyver = '%d%d' % tuple(sys.version_info[:2])
68+
if (pyver == '27') and (os.name == 'posix'): # Python 2.7 on Linux requires `$LD_LIBRARY_PATH`
69+
ld_library_path = os.path.join(
70+
os.path.dirname(os.path.dirname(sys.executable)), 'lib')
71+
toxenv = 'py%s' % pyver
72+
if os.name == 'posix':
73+
toxenv += ',py%s-flake8' % pyver
6774
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
75+
if ld_library_path:
76+
f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
77+
f.write('TOXENV=' + toxenv + '\n')
78+
"
79+
shell: ${{ env.SHELL }}
7280

7381
- name: Run tox
7482
run: |
7583
python -c "import os; print(os.environ['TOXENV'])"
7684
tox --version
7785
tox
86+
shell: ${{ env.SHELL }}

0 commit comments

Comments
 (0)