aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: fb314ef8737700d1f8ed35a08e60330c07897241 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  lint:
    runs-on: ubuntu-latest
    # https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8
    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.x
      uses: actions/setup-python@v2
      with:
        python-version: "3.x"
    - name: Install packages
      run: pip install tox
    - name: Run Tox
      run: tox -e mypy,package_readme

  test:
    runs-on: ${{ matrix.platform }}
    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
    strategy:
      matrix:
        python-version: [3.7, 3.8, 3.9]
        platform: [ubuntu-latest, macos-latest, windows-latest]
        exclude: # Only test on the oldest and latest supported stable Python on macOS and Windows.
          - platform: macos-latest
            python-version: 3.7
          - platform: macos-latest
            python-version: 3.9
          - platform: windows-latest
            python-version: 3.7
          - platform: windows-latest
            python-version: 3.9
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install packages
      run: pip install tox coverage
    - name: Run Tox
      run: tox -e py-cov
    - name: Run Tox without lxml
      run: tox -e py-cov-nolxml
    - name: Produce coverage files
      run: |
        coverage combine
        coverage xml
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        file: coverage.xml
        flags: unittests
        name: codecov-umbrella
        fail_ci_if_error: true

  test-cython:
    runs-on: ubuntu-latest
    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.x
      uses: actions/setup-python@v2
      with:
        python-version: 3.9
    - name: Install packages
      run: pip install tox
    - name: Run Tox
      run: tox -e py-cy-nolxml

  test-pypy3:
    runs-on: ubuntu-latest
    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python pypy3
      uses: actions/setup-python@v2
      with:
        python-version: "pypy-3.7"
    - name: Install packages
      run: pip install tox
    - name: Run Tox
      run: tox -e pypy3-nolxml