summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 933d6ee8e90acc96fb50f8000100d75b2d2ebcb5 (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
name: CI

on: [push, pull_request]

defaults:
  run:
    shell: bash

jobs:
  package:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
      - name: Set up Python 3.7
        uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - name: Check packages
        run: |
          python3.7 -m pip install wheel twine rstcheck;
          python3.7 setup.py sdist bdist_wheel;
          rstcheck README.rst CHANGES.rst
          python3.7 -m twine check dist/*
  test:
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
        os: [macos-latest, windows-latest, ubuntu-latest]
        experimental: [false]
        nox-session: ['']
        include:
          - python-version: pypy3
            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
          - python-version: 3.10.0-beta.3
            os: ubuntu-latest
            experimental: false
            nox-session: test-3.10

    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 }}
    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
        run: ./ci/upload_coverage.sh
        env:
          JOB_NAME: "${{ runner.os }} (${{ matrix.python-version }})"