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