]> git.phdru.name Git - sqlconvert.git/blob - .github/workflows/run-tests.yaml
CI(GHActions): Setup PostgreSQL using `ankane/setup-postgres@v1`
[sqlconvert.git] / .github / workflows / run-tests.yaml
1 name: Run tests
2
3 on: [push, pull_request]
4
5 jobs:
6   run-tests:
7
8     strategy:
9       matrix:
10         python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
11
12     name: Python ${{ matrix.python-version }}
13     runs-on: ubuntu-latest
14
15     steps:
16
17       - uses: ankane/setup-postgres@v1
18       - uses: actions/checkout@v2
19       - uses: actions/setup-python@v2
20         with:
21           python-version: ${{ matrix.python-version }}
22       - name: Cache pip
23         uses: actions/cache@v2
24         with:
25           # This path is specific to Linux/Unix
26           path: ~/.cache/pip
27           key: ${{ runner.os }}-pip
28       - name: Install dependencies
29         run: |
30           python --version
31           python -m pip install --upgrade "pip<21.0" "setuptools<45" wheel
32           pip --version
33           pip install --upgrade virtualenv tox
34       - name: Set TOXENV
35         run: |
36           import os, sys
37           pyver = '%d%d' % tuple(sys.version_info[:2])
38           toxenv = 'py%s' % pyver
39           toxenv += ',py%s-sqlite' % pyver
40           toxenv += ',py%s-postgres' % pyver
41           toxenv += ',py%s-flake8' % pyver
42           with open(os.environ['GITHUB_ENV'], 'a') as f:
43             f.write('TOXENV=' + toxenv + '\n')
44         shell: python
45       - name: Run tox
46         run: |
47           python -c "import os; print(os.environ['TOXENV'])"
48           tox