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