1name: Test
2
3on:
4  push:
5    branches: [main]
6  pull_request:
7    branches: [main]
8
9jobs:
10  lint:
11    runs-on: ubuntu-latest
12    # https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8
13    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
14    steps:
15    - uses: actions/checkout@v2
16    - name: Set up Python 3.x
17      uses: actions/setup-python@v2
18      with:
19        python-version: "3.x"
20    - name: Install packages
21      run: pip install tox
22    - name: Run Tox
23      run: tox -e mypy,package_readme
24
25  test:
26    runs-on: ${{ matrix.platform }}
27    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
28    strategy:
29      matrix:
30        python-version: [3.6, 3.7, 3.8, 3.9]
31        platform: [ubuntu-latest, macos-latest, windows-latest]
32        exclude: # Only test on the oldest and latest supported stable Python on macOS and Windows.
33          - platform: macos-latest
34            python-version: 3.7
35          - platform: macos-latest
36            python-version: 3.8
37          - platform: windows-latest
38            python-version: 3.7
39          - platform: windows-latest
40            python-version: 3.8
41    steps:
42    - uses: actions/checkout@v2
43    - name: Set up Python ${{ matrix.python-version }}
44      uses: actions/setup-python@v2
45      with:
46        python-version: ${{ matrix.python-version }}
47    - name: Install packages
48      run: pip install tox coverage
49    - name: Run Tox
50      run: tox -e py-cov
51    - name: Run Tox without lxml
52      run: tox -e py-cov-nolxml
53    - name: Produce coverage files
54      run: |
55        coverage combine
56        coverage xml
57    - name: Upload coverage to Codecov
58      uses: codecov/codecov-action@v1
59      with:
60        file: coverage.xml
61        flags: unittests
62        name: codecov-umbrella
63        fail_ci_if_error: true
64
65  test-cython:
66    runs-on: ubuntu-latest
67    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
68    steps:
69    - uses: actions/checkout@v2
70    - name: Set up Python 3.x
71      uses: actions/setup-python@v2
72      with:
73        python-version: "3.x"
74    - name: Install packages
75      run: pip install tox
76    - name: Run Tox
77      run: tox -e py-cy-nolxml
78
79  test-pypy3:
80    runs-on: ubuntu-latest
81    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
82    steps:
83    - uses: actions/checkout@v2
84    - name: Set up Python pypy3
85      uses: actions/setup-python@v2
86      with:
87        python-version: "pypy3"
88    - name: Install packages
89      run: pip install tox
90    - name: Run Tox
91      run: tox -e pypy3-nolxml
92