-
Notifications
You must be signed in to change notification settings - Fork 6
263 lines (249 loc) · 8.97 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
name: Build
on:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
- feature/*
workflow_dispatch:
env:
RUSTDOCFLAGS: -Dwarnings
CARGO_INCREMENTAL: 0
jobs:
fmt:
name: Code Style
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: cargo fmt
run: cargo fmt -v --all -- --check
- name: cargo clippy
run: cargo clippy -vv --all-targets -- -D warnings
- name: cargo doc
run: cargo doc -vv --all --no-deps
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install Python packages
run: |
python -m pip install -U pip
python -m pip install -r pip/requirements-dev.txt
- name: Python formatting
run: python -m black --check pip
- name: Publish Docs as Artifacts
uses: actions/upload-artifact@v2
with:
name: docs
path: target/doc
benches:
name: Benches
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: cargo bench
run: cargo bench --workspace
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- name: Setup rust toolchain
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build -vv --release
- name: Test
run: cargo test -vv --release -- --nocapture
nightly:
name: Build Nightly
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: rustfmt, clippy, llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Build Nightly
run: cargo build -vv --release
- name: Test Nightly
run: cargo test -vv --release -- --nocapture
release:
name: Release
runs-on: ${{ matrix.config.os }}
env: ${{ matrix.config.env }}
strategy:
fail-fast: false
matrix:
config:
- { os: "ubuntu-20.04", arch: "amd64", env: { AUDITWHEEL_TAG: "manylinux_2_31_x86_64" } }
- { os: "ubuntu-22.04", arch: "amd64", env: { AUDITWHEEL_TAG: "manylinux_2_35_x86_64" } }
- { os: "windows-2019", arch: "amd64", env: {} }
- { os: "macos-11", arch: "amd64", env: { MACOSX_DEPLOYMENT_TARGET: 10.9 } }
- { os: "macos-14", arch: "arm64", env: {} }
- { os: "macos-14", arch: "universal", env: { ARCHFLAGS: "-arch arm64 -arch x86_64" } }
steps:
- uses: actions/checkout@v4
- name: Setup rust toolchain
run: rustup show
- shell: pwsh
run: |
rustup target add x86_64-apple-darwin
if: ${{ (matrix.config.os == 'macos-14') && (matrix.config.arch == 'universal') }}
- name: Install LLVM
uses: ./.github/actions/install-llvm
with:
version: "14"
os: ${{ matrix.config.os }}
directory: ${{ github.workspace }}/target/llvm
arch: ${{ matrix.config.arch }}
- name: Build
run: cargo build -vv --release
- name: Test
run: cargo test -vv --release -- --nocapture
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
if: ${{ matrix.config.os != 'macos-14' }}
- name: Install Unconditional Python packages
run: |
python -m pip install -U pip
python -m pip install -r pip/requirements.txt
- name: Install Auditwheel Python packages for Linux
run: |
python -m pip install -r pip/requirements-manylinux.txt
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }}
- name: Package Non-Linux
run: python -m pip --verbose wheel --verbose --wheel-dir target/wheels ./pip
if: ${{ matrix.config.os != 'ubuntu-20.04' && matrix.config.os != 'ubuntu-22.04' }}
- name: Package Linux
run: python -m pip --verbose wheel --verbose --wheel-dir target/raw-wheels ./pip
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }}
- name: Auditwheel
run: auditwheel repair --plat $AUDITWHEEL_TAG --wheel-dir target/wheels target/raw-wheels/*.whl
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }}
- name: Test Wheel
run: |
python -m pip install -r pip/requirements-test.txt
python -m pip install --force-reinstall --no-index --find-links=target/wheels qirrunner
python -m pytest --verbose pip
if: ${{ matrix.config.os == 'ubuntu-20.04' || matrix.config.os == 'ubuntu-22.04' }}
# qir-stdlib Artifact
- name: qir-stdlib Artifact (Library)
if: ${{ matrix.config.os != 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: target/release/libqir_stdlib.a
- name: qir-stdlib Artifact (Library on Windows)
if: ${{ matrix.config.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: target/release/qir_stdlib.lib
- name: qir-stdlib Artifact (Definition file)
if: ${{ matrix.config.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: stdlib/include/qir_stdlib.def
- name: qir-stdlib Artifact (Header file)
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: stdlib/include/qir_stdlib.h
- name: qir-stdlib Artifact (Notice file)
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: runner/NOTICE.txt
- name: qir-stdlib Artifact (License file)
uses: actions/upload-artifact@v3
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: LICENSE
# qir-runner Artifact
- name: Artifacts executable
if: ${{ matrix.config.os != 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: qir-runner-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: target/release/qir-runner
- name: Artifacts executable (Windows)
if: ${{ matrix.config.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: qir-runner-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: target/release/qir-runner.exe
- name: Artifacts Notice file
uses: actions/upload-artifact@v3
with:
name: qir-runner-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: runner/NOTICE.txt
- name: Artifacts License file
uses: actions/upload-artifact@v3
with:
name: qir-runner-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: LICENSE
- name: Wheel Artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-artifacts-${{ matrix.config.os }}-${{ matrix.config.arch }}
path: target/wheels/*
merge:
runs-on: ubuntu-latest
needs: release
steps:
- name: Merge Wheel Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: wheels
pattern: wheel-artifacts-*
docs:
runs-on: "ubuntu-22.04"
needs: fmt
steps:
- uses: actions/checkout@v3
- name: Download Build Artifacts
uses: actions/download-artifact@v2
with:
name: docs
path: target/doc
- name: Index Page Redirection
run: echo '<meta http-equiv="refresh" content="0; url=qir_runner">' > target/doc/index.html
- name: Publish Docs to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: target/doc
if: github.event_name == 'push' && github.ref == 'refs/heads/main'