-
Notifications
You must be signed in to change notification settings - Fork 37
98 lines (78 loc) · 2.09 KB
/
ci_cd.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
97
98
name: "CI/CD"
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Don't continue building images for a PR if the PR is updated quickly
# For other workflows, allow them to complete and just block on them. This
# ensures deployments in particular to happen in series rather than parallel.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install hatch
run: pipx install hatch
- name: Lint
run: hatch run lint:run
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install hatch
run: pipx install hatch
- name: Install twine
run: pipx install twine
- name: Build distribution
run: hatch build
- name: Check build
run: twine check --strict dist/*
test:
name: test on ${{ matrix.py }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
py:
- 'pypy3.10'
- '3.12'
- '3.11'
- '3.10'
- '3.9'
- '3.8'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
cache: pip
- name: Install hatch
run: pipx install hatch
- name: Run test suite
run: hatch run test.${{ !startsWith(matrix.py, 'pypy') && 'py' || '' }}${{ matrix.py }}:test