3 on: [push, pull_request]
12 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 pip-cache-path: ~/.cache/pip
20 pip-cache-path: ~\AppData\Local\pip\Cache
22 name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
23 runs-on: ${{ matrix.os }}
28 - uses: actions/checkout@v2
29 - uses: s-weigand/setup-conda@v1
31 conda-channels: conda-forge
32 python-version: ${{ matrix.python-version }}
33 if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
34 - uses: actions/setup-python@v4
36 python-version: ${{ matrix.python-version }}
37 if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }}
39 uses: actions/cache@v3
41 path: ${{ matrix.pip-cache-path }}
42 key: ${{ runner.os }}-pip
45 - name: Install dependencies
48 python -m pip || python -m ensurepip --default-pip --upgrade
49 python -m pip install --upgrade pip setuptools wheel
51 pip install --upgrade virtualenv "tox >= 3.15, < 4"
55 ld_library_path = None
56 if hasattr(sys, 'pypy_version_info'):
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 with open(os.environ['GITHUB_ENV'], 'a') as f:
69 f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
70 f.write('TOXENV=' + toxenv + '\n')
75 python -c "import os; print(os.environ['TOXENV'])"