]> git.phdru.name Git - m_librarian.git/blob - .github/workflows/run-tests.yaml
c1d896de2b63574a171abaa1c1244b4b731bebce
[m_librarian.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       fail-fast: false
10       matrix:
11         os: [ubuntu-latest, macos-latest, windows-latest]
12         python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
13         include:
14         - os: ubuntu-latest
15           os-name: Linux
16           pip-cache-path: ~/.cache/pip
17         - os: macos-latest
18           os-name: OSX
19           pip-cache-path: ~/Library/Caches/pip
20         - os: windows-latest
21           os-name: w32
22           pip-cache-path: ~\AppData\Local\pip\Cache
23
24     name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
25     runs-on: ${{ matrix.os }}
26
27     steps:
28       - uses: actions/checkout@v2
29       - uses: actions/setup-python@v2
30         with:
31           python-version: ${{ matrix.python-version }}
32       - name: Cache pip
33         uses: actions/cache@v2
34         with:
35           path: ${{ matrix.pip-cache-path }}
36           key: ${{ runner.os }}-pip
37       - name: Install dependencies
38         run: |
39           python --version
40           python -m pip install --upgrade "pip<21.0" "setuptools<45" wheel
41           pip --version
42           pip install --upgrade virtualenv tox
43       - name: Set TOXENV
44         run: |
45           import os, sys
46           pyver = '%d%d' % tuple(sys.version_info[:2])
47           toxenv = 'py%s-sqlite' % pyver
48           if os.name == 'posix':
49             toxenv += ',py%s-flake8' % pyver
50           elif os.name == 'nt':
51             toxenv += '-w32'
52           with open(os.environ['GITHUB_ENV'], 'a') as f:
53             f.write('TOXENV=' + toxenv + '\n')
54         shell: python
55       - name: Run tox
56         run: |
57           python -c "import os; print(os.environ['TOXENV'])"
58           python -m tox