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