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"]
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: ankane/setup-postgres@v1
29 - name: Setup Postgres user @ Linux
31 sudo -u postgres psql --command="ALTER USER runner CREATEDB PASSWORD 'test'"
32 if: ${{ runner.os == 'Linux' }}
33 - name: Setup Postgres user @ w32
35 psql --command="CREATE USER runner CREATEDB PASSWORD 'test'"
36 if: ${{ runner.os == 'Windows' }}
39 - uses: actions/checkout@v2
40 - uses: s-weigand/setup-conda@v1
42 conda-channels: conda-forge
43 python-version: ${{ matrix.python-version }}
44 if: ${{ !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
45 - uses: actions/setup-python@v4
47 python-version: ${{ matrix.python-version }}
48 if: ${{ contains(fromJSON(env.not_in_conda), matrix.python-version) }}
50 uses: actions/cache@v3
52 path: ${{ matrix.pip-cache-path }}
53 key: ${{ runner.os }}-pip
56 - name: Install dependencies
60 python -m pip install --upgrade pip setuptools wheel
62 pip install --upgrade virtualenv "tox >= 3.15, < 4"
66 ld_library_path = None
67 pyver = '%d%d' % tuple(sys.version_info[:2])
68 toxenv = 'py%s' % pyver
69 toxenv += ',py%s-sqlite' % pyver
72 toxenv += ',py%s-postgres' % pyver
73 if os.name == 'posix':
74 if pyver == '27': # Python 2.7 on Linux requires `$LD_LIBRARY_PATH`
75 ld_library_path = os.path.join(
76 os.path.dirname(os.path.dirname(sys.executable)), 'lib')
77 toxenv += ',py%s-flake8' % pyver
80 with open(os.environ['GITHUB_ENV'], 'a') as f:
82 f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
83 f.write('TOXENV=' + toxenv + '\n')
84 f.write('PGPASSWORD=test\n')
89 python -c "import os; print(os.environ['TOXENV'])"