3 on: [push, pull_request]
10 os: [ubuntu-latest, windows-latest]
11 python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
15 pip-cache-path: ~/.cache/pip
18 pip-cache-path: ~\AppData\Local\pip\Cache
20 name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
21 runs-on: ${{ matrix.os }}
26 - uses: ankane/setup-postgres@v1
27 - name: Setup Postgres user @ Linux
29 sudo -u postgres psql --command="ALTER USER runner CREATEDB PASSWORD 'test'"
30 if: ${{ runner.os == 'Linux' }}
31 - name: Setup Postgres user @ w32
33 psql --command="CREATE USER runner CREATEDB PASSWORD 'test'"
34 if: ${{ runner.os == 'Windows' }}
37 - uses: actions/checkout@v2
38 - uses: s-weigand/setup-conda@v1
40 python-version: ${{ matrix.python-version }}
41 if: ${{ runner.os == 'Linux' && matrix.python-version != '3.11' }}
42 - uses: actions/setup-python@v4
44 python-version: ${{ matrix.python-version }}
45 if: ${{ runner.os != 'Linux' || matrix.python-version == '3.11' }}
47 uses: actions/cache@v3
49 path: ${{ matrix.pip-cache-path }}
50 key: ${{ runner.os }}-pip
53 - name: Install dependencies
56 python -m pip install --upgrade pip setuptools wheel
58 pip install --upgrade virtualenv "tox < 4"
62 ld_library_path = None
63 pyver = '%d%d' % tuple(sys.version_info[:2])
64 toxenv = 'py%s' % pyver
65 toxenv += ',py%s-sqlite' % pyver
68 toxenv += ',py%s-postgres' % pyver
69 if os.name == 'posix':
70 if pyver == '27': # 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-flake8' % pyver
76 with open(os.environ['GITHUB_ENV'], 'a') as f:
78 f.write('LD_LIBRARY_PATH=' + ld_library_path + '\n')
79 f.write('TOXENV=' + toxenv + '\n')
80 f.write('PGPASSWORD=test\n')
85 python -c "import os; print(os.environ['TOXENV'])"