]> git.phdru.name Git - m_librarian.git/blob - .github/workflows/run-tests.yaml
4eeebaee9dfa9cbc6899eac1285e087eeb90f3d6
[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", "3.10"]
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
29       # Setup Python/pip
30       - uses: actions/checkout@v2
31       - uses: actions/setup-python@v2
32         with:
33           python-version: ${{ matrix.python-version }}
34       - name: Cache pip
35         uses: actions/cache@v2
36         with:
37           path: ${{ matrix.pip-cache-path }}
38           key: ${{ runner.os }}-pip
39
40       # Setup tox
41       - name: Install dependencies
42         run: |
43           python --version
44           python -m pip install --upgrade pip setuptools wheel
45           pip --version
46           pip install --upgrade virtualenv tox
47       - name: Set TOXENV
48         run: |
49           import os, sys
50           pyver = '%d%d' % tuple(sys.version_info[:2])
51           toxenv = 'py%s-sqlite' % pyver
52           if os.name == 'posix':
53             toxenv += ',py%s-flake8' % pyver
54           elif os.name == 'nt':
55             toxenv += '-w32'
56           with open(os.environ['GITHUB_ENV'], 'a') as f:
57             f.write('TOXENV=' + toxenv + '\n')
58         shell: python
59
60       - name: Run tox
61         run: |
62           python -c "import os; print(os.environ['TOXENV'])"
63           tox