summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 5fecb46d9e200c34e328f5e0a3a5752351c23fc1 (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
92
93
94
95
96
97
98
99
100
101
name: CI

on: [push, pull_request]

defaults:
  run:
    shell: bash

jobs:
  package:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
      - name: Set up Python 3
        uses: actions/setup-python@v2
        with:
          python-version: "3"
      - name: Check packages
        run: |
          python3 -m pip install wheel twine rstcheck;
          python3 setup.py sdist bdist_wheel;
          rstcheck README.rst CHANGES.rst
          python3 -m twine check dist/*
  test:
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.7", "3.8", "3.9", "3.10"]
        os: [macos-latest, windows-latest, ubuntu-latest]
        experimental: [false]
        nox-session: ['']
        include:
          - python-version: "pypy-3.7"
            os: ubuntu-latest
            experimental: false
            nox-session: test-pypy
          - python-version: "2.7"
            os: ubuntu-latest
            experimental: false
            nox-session: unsupported_python2
          - python-version: "3.9"
            os: ubuntu-latest
            experimental: false
            nox-session: test_brotlipy
          # Test CPython with a broken hostname_checks_common_name (the fix is in 3.9.3)
          - python-version: "3.9.2"
            os: ubuntu-latest
            experimental: false
            nox-session: test-3.9

    runs-on: ${{ matrix.os }}
    name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')[matrix.os] }} ${{ matrix.python-version }} ${{ matrix.nox-session}}
    continue-on-error: ${{ matrix.experimental }}
    timeout-minutes: 20
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Set Up Python - ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}

      - name: Set Up Python - ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        if: "!endsWith(matrix.python-version, '-dev')"
        with:
          python-version: ${{ matrix.python-version }}

      - name: Set Up Python - ${{ matrix.python-version }}
        uses: deadsnakes/action@v2.0.2
        if: endsWith(matrix.python-version, '-dev')
        with:
          python-version: ${{ matrix.python-version }}

      - name: Set Up Python 3 to run nox on Python 2
        if: matrix.python-version == '2.7'
        uses: actions/setup-python@v2
        with:
          python-version: "3"

      - name: Install Dependencies
        run: python -m pip install --upgrade nox

      - name: Run Tests
        run: ./ci/run_tests.sh
        env:
          PYTHON_VERSION: ${{ matrix.python-version }}
          NOX_SESSION: ${{ matrix.nox-session }}

      - name: Upload Coverage
        if: ${{ matrix.nox-session != 'unsupported_python2' }}
        uses: codecov/codecov-action@v2
        with:
          fail_ci_if_error: true
          name: "${{ runner.os }} (${{ matrix.python-version }})"
          files: ./coverage.xml
          verbose: true