summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 780b0c0f58c45609497a5965f715767d404afaab (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
# For documentation on GitHub Actions Workflows, see:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: CI

on:
  push:
    branches:
      - master
      - 2.0
  pull_request:
    branches:
      - master
      - 2.0

env:
  PYTHON_LATEST: 3.9

jobs:
  ci:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: [3.6, 3.7, 3.8, 3.9, 3.10-dev]
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2  # https://github.com/actions/checkout
        with:
          # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow.
          # Set fetch-depth: 0 to fetch all history for all branches and tags.
          fetch-depth: 0 # Needed for setuptools_scm to work correctly
      - name: Set up Python
        uses: actions/setup-python@v2  # https://github.com/actions/setup-python
        with:
          python-version: ${{ matrix.python-version }}
#      - name: Cache dependencies
#        id: cache-deps
#        uses: actions/cache@v2  # https://github.com/actions/cache
#        with:
#          path: ~/.cache/pip
#          key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
      - name: Install python prerequisites
        # Only install dependencies when there is a cache miss
#        if: steps.cache-deps.outputs.cache-hit != 'true'
        run: pip install -U --user pip setuptools setuptools-scm flake8 nox
      - name: Lint
        if: matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_LATEST
        run: flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;
      - name: Run tests and post coverage results
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: python -m nox --non-interactive --session tests-${{ matrix.python-version }}  # Run nox for a single version of Python