forked from aiortc/aioquic
-
Notifications
You must be signed in to change notification settings - Fork 2
236 lines (225 loc) · 7.07 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# This file is autogenerated by maturin v1.2.3
# To update, run
#
# maturin generate-ci github
#
name: CI
on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install pre-commit
name: Install pre-commit
- run: pre-commit run --all
name: Run pre-commit checks
test:
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest ] # windows-latest
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
exclude:
# circumvent wierd issue with qh3.asyncio+windows+proactor loop...
- python_version: pypy-3.9
os: windows-latest
- python_version: pypy-3.10
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Setup dependencies
run: pip install --upgrade pip pytest
- name: Set up Clang (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install clang
- name: Set up Clang (Cygwin)
if: matrix.os == 'windows-latest'
run: |
choco install llvm -y
choco install nasm -y
- name: Build wheels (Unix, Linux)
if: matrix.os != 'windows-latest'
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --interpreter ${{ matrix.python_version }}
sccache: 'true'
manylinux: auto
before-script-linux: |
sudo apt-get update || echo "no apt support"
sudo apt-get upgrade -y || echo "no apt support"
sudo apt-get install -y libclang-dev || echo "no apt support"
sudo apt-get install -y linux-headers-generic || echo "no apt support"
sudo apt-get install -y libc6-dev || echo "no apt support"
yum install -y llvm-toolset-7-clang || echo "not yum based"
source /opt/rh/llvm-toolset-7/enable || echo "not yum based"
- name: Build wheels (NT)
if: matrix.os == 'windows-latest'
uses: PyO3/maturin-action@v1.42.1
with:
args: --release --out dist
sccache: 'true'
target: x64
- run: pip install --find-links=./dist qh3
name: Install built package
- name: Disable firewall and configure compiler
if: matrix.os == 'macos-latest'
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "AIOQUIC_SKIP_TESTS=chacha20" >> $GITHUB_ENV
- name: Ensure test target (NT)
if: matrix.os == 'windows-latest'
run: Remove-Item -Path qh3 -Force -Recurse
- name: Ensure test target (Linux, Unix)
if: matrix.os != 'windows-latest'
run: rm -fR qh3
- run: python -m pip install -r dev-requirements.txt
name: Install dev requirements
- run: python -m unittest discover -v
name: Run tests
build-wheels:
needs:
- test
- lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
arch: arm64
- os: macos-latest
arch: x86_64
- os: ubuntu-latest
arch: i686
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-latest
arch: aarch64
- os: windows-latest
arch: AMD64
- os: windows-latest
arch: x86
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: rustup target add aarch64-apple-darwin
if: matrix.os == 'macos-latest'
- run: rustup toolchain install stable-i686-pc-windows-msvc
if: matrix.os == 'windows-latest'
- run: rustup target add i686-pc-windows-msvc
if: matrix.os == 'windows-latest'
- name: Build wheels
env:
CIBW_BUILD_FRONTEND: build
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS="ipv6,loss" PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"
CIBW_BUILD: cp39-* pp310-* pp39-* pp38-* pp37-*
CIBW_TEST_COMMAND: python -m unittest discover -t {project} -s {project}/tests
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
run: |
pip install cibuildwheel
cibuildwheel --output-dir dist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
sdist:
needs:
- test
- lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
checksum:
name: Compute hashes
runs-on: ubuntu-latest
needs: [build-wheels, sdist]
if: "startsWith(github.ref, 'refs/tags/')"
outputs:
hashes: ${{ steps.compute.outputs.hashes }}
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Download distributions
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: wheels
path: dist
- name: Collected dists
run: |
tree dist
- name: Generate hashes
id: compute # needs.checksum.outputs.hashes
working-directory: ./dist
run: echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
provenance:
needs: checksum
if: "startsWith(github.ref, 'refs/tags/')"
uses: "slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0"
permissions:
actions: read
id-token: write
contents: write
with:
base64-subjects: ${{ needs.checksum.outputs.hashes }}
upload-assets: true
compile-generator: true
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: provenance
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1.42.1
with:
command: upload
args: --non-interactive --skip-existing *