-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (93 loc) · 2.77 KB
/
check.yml
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
name: check
on:
pull_request:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
venv
key: >-
lint-${{ hashFiles(
'.github/requirements.txt',
'requirements-dev.txt',
'requirements-test.txt',
'setup.cfg'
) }}
restore-keys: lint-
- name: Install dependencies
run: |
set -euxo pipefail
# venv due to mypy through pre-commit, venv-run
python3 -m venv venv
venv/bin/python3 -m pip install -Ur .github/requirements.txt
- run: venv/bin/gitlint --commits "origin/$GITHUB_BASE_REF..HEAD"
if: github.event_name == 'pull_request'
- uses: pre-commit/[email protected]
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13.0-alpha - 3.13"
- "pypy-3.9"
- "pypy-3.10"
include:
- python-version: "3.5"
os: ubuntu-20.04
extra-deps: "'virtualenv<20.22.0'"
- python-version: "3.6"
os: ubuntu-20.04
extra-deps: "'virtualenv<20.22.0'"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# >= 3.11 to ensure there's a recent one to run nox with
# (assumption: last one listed ends up as "python3")
python-version: |
${{ matrix.python-version }}
>=3.11
env:
# Use system CA certs for setup-python's auto upgrade of pip to work
# on older versions (e.g. 3.5) that do not have pypi.org CA certs in
# baseline pip's chain
PIP_CERT: /etc/ssl/certs/ca-certificates.crt
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
.nox
key: >-
test-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles(
'requirements-test.txt'
) }}
restore-keys: test-${{ runner.os }}-${{ matrix.python-version }}-
- run: |
set -euxo pipefail
python3 -m pip install -U nox codecov ${{ matrix.extra-deps }}
v="${{ matrix.python-version }}"
v=${v##* } # "3.12.0-alpha - 3.12" -> "3.12"
v=${v//-} # "pypy-3.9" -> "pypy3.9"
nox --force-color --python $v
codecov -X gcov
env:
PYTEST_ADDOPTS: --color=yes