-
Notifications
You must be signed in to change notification settings - Fork 6
167 lines (160 loc) · 4.48 KB
/
ci.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: CI
on:
push:
branches:
- 'master'
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6
tags: [ 'v*' ]
pull_request:
branches:
- 'master'
- '[0-9].[0-9]+'
schedule:
- cron: '0 6 * * *' # Daily 6AM UTC build
jobs:
lint:
name: Linter
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/[email protected]
- name: Cache pre-commit
uses: actions/[email protected]
with:
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
path: ~/.cache/pre-commit
restore-keys: |
pre-commit-
- name: Cache pip
uses: actions/[email protected]
with:
key: pip-lint-${{ hashFiles('setup.cfg', 'requirements.txt') }}
path: ~/.cache/pip
restore-keys: |
pip-lint-
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run linter
run: |
make pre-commit
mypy:
name: Mypy
strategy:
matrix:
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.pyver }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.pyver }}
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT" # - name: Cache
- name: Cache PyPI
uses: actions/[email protected]
with:
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('setup.cfg', 'requirements.txt') }}
path: ${{ steps.pip-cache.outputs.dir }}
restore-keys: |
pip-ci-${{ runner.os }}-${{ matrix.pyver }}-
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run mypy
run: |
make mypy
test:
name: Test
strategy:
matrix:
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu, windows]
fail-fast: false
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.pyver }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.pyver }}
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT" # - name: Cache
- name: Cache PyPI
uses: actions/[email protected]
with:
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('setup.cfg', 'requirements.txt') }}
path: ${{ steps.pip-cache.outputs.dir }}
restore-keys: |
pip-ci-${{ runner.os }}-${{ matrix.pyver }}-
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run unittests
run: |
make cov
- name: Generate coverage XML
run: |
coverage xml
- name: Upload coverage artifact
uses: aio-libs/[email protected]
with:
key: ${{ matrix.pyver }}-${{ matrix.os }}
check:
name: Test matrix status
needs: [lint, test, mypy]
runs-on: ubuntu-latest
if: always()
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
- name: Upload coverage
uses: aio-libs/[email protected]
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: release
needs: check
# Run only on pushing a tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/[email protected]
- name: Install dependencies
run: |
python -m pip install -U pip build
- name: Make dists
run: |
python -m build
- name: Release
uses: aio-libs/[email protected]
with:
changes_file: CHANGES.rst
name: aioloop-proxy
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
check_ref: ${{ github.ref }}
fix_issue_regex: ":issue:`(\\d+)`"
fix_issue_repl: "(#\\1)"