]> git.phdru.name Git - sqlconvert.git/blob - .github/workflows/run-tests.yaml
CI: Run tests at Github Actions
[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       - uses: actions/checkout@v2
17       - uses: actions/setup-python@v2
18         with:
19           python-version: ${{ matrix.python-version }}
20       - name: Cache pip
21         uses: actions/cache@v2
22         with:
23           # This path is specific to Linux/Unix
24           path: ~/.cache/pip
25           key: ${{ runner.os }}-pip
26       - name: Install dependencies
27         run: |
28           python --version
29           python -m pip install --upgrade "pip<21.0" "setuptools<45" wheel
30           pip --version
31           pip install --upgrade virtualenv tox
32       - name: Set TOXENV
33         run: |
34           import os, sys
35           pyver = '%d%d' % tuple(sys.version_info[:2])
36           toxenv = 'py%s' % pyver
37           toxenv += ',py%s-sqlite' % pyver
38           if os.name == 'posix':
39             toxenv += ',py%s-flake8' % pyver
40           with open(os.environ['GITHUB_ENV'], 'a') as f:
41             f.write('TOXENV=' + toxenv + '\n')
42         shell: python
43       - name: Run tox
44         run: |
45           python -c "import os; print(os.environ['TOXENV'])"
46           tox