]> git.phdru.name Git - mimedecode.git/blob - .github/workflows/run-tests.yaml
7577e272adbbb68f3fbfc3245a412420f9fb88a7
[mimedecode.git] / .github / workflows / run-tests.yaml
1 name: Run tests
2
3 on: [push, pull_request]
4
5 jobs:
6   run-tests:
7     env:
8       not_in_conda: "['3.11', 'pypy-3.7']"
9
10     strategy:
11       matrix:
12         python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7"]
13
14     name: Python ${{ matrix.python-version }}
15     runs-on: ubuntu-latest
16
17     steps:
18
19       # Setup Python/pip
20       - uses: actions/checkout@v2
21       - uses: s-weigand/setup-conda@v1
22         with:
23           python-version: ${{ matrix.python-version }}
24         if: ${{ runner.os == 'Linux' && !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
25       - uses: actions/setup-python@v4
26         with:
27           python-version: ${{ matrix.python-version }}
28         if: ${{ runner.os != 'Linux' || contains(fromJSON(env.not_in_conda), matrix.python-version) }}
29       - name: Cache pip
30         uses: actions/cache@v3
31         with:
32           # This path is specific to Linux/Unix
33           path: ~/.cache/pip
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 = 'pypy3'
48           else:
49             pyver = '%d%d' % tuple(sys.version_info[:2])
50             toxenv = 'py%s' % pyver
51           with open(os.environ['GITHUB_ENV'], 'a') as f:
52             f.write('TOXENV=' + toxenv + '\n')
53         shell: python
54
55
56       - name: Run tox targets for ${{ matrix.python-version }}
57         run: |
58           python -c "import os; print(os.environ['TOXENV'])"
59           tox --version
60           tox