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