summaryrefslogtreecommitdiff
path: root/.github/workflows/tests.yml
blob: 9ea114e775751254eac1dfd1bb827fd1aaa911c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on:
  push:
  pull_request:
  schedule:
    - cron: '0 12 * * 0'  # run once a week on Sunday
  # Allow to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    strategy:
      # We want to see all failures:
      fail-fast: false
      matrix:
        os:
        - ubuntu
        config:
        # [Python version, tox env]
        - ["3.8",   "lint"]
        - ["2.7",   "py27"]
        - ["3.5",   "py35"]
        - ["3.6",   "py36"]
        - ["3.7",   "py37"]
        - ["3.8",   "py38"]
        - ["3.9",   "py39"]
        - ["pypy2", "pypy"]
        - ["pypy3", "pypy3"]
        - ["3.8",   "docs"]
        - ["3.8",   "coverage"]

    runs-on: ${{ matrix.os }}-latest
    name: ${{ matrix.config[1] }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.config[0] }}
    - name: Pip cache
      uses: actions/cache@v2
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
        restore-keys: |
          ${{ runner.os }}-pip-${{ matrix.config[0] }}-
          ${{ runner.os }}-pip-
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install tox
    - name: Test
      run: tox -e ${{ matrix.config[1] }}
    - name: Coverage
      if: matrix.config[1] == 'coverage'
      run: |
        pip install coveralls coverage-python-version
        coveralls --service=github
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}