-
Notifications
You must be signed in to change notification settings - Fork 4
202 lines (187 loc) · 6.59 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
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@v4
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14.0"
- name: Setup rust toolchain
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.78.0
components: rustfmt clippy
- 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@v4
with:
name: docs
path: target/doc
benches:
name: Benches
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
- name: cargo bench
run: cargo bench --workspace
ci:
name: ci
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-14", arch: "arm64", env: {} }
steps:
- uses: actions/checkout@v4
- name: Setup rust toolchain
uses: ./.github/actions/rust-toolchain
with:
toolchain: 1.78.0
components: rustfmt clippy
- 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 build --verbose --sdist --outdir target/wheels ./pip
python -m build --verbose --wheel ./pip
if: ${{ matrix.config.os != 'ubuntu-20.04' && matrix.config.os != 'ubuntu-22.04' }}
- name: Package Linux
run: |
python -m build --verbose --sdist --outdir target/wheels ./pip
python -m build --verbose --wheel --outdir target/raw-wheels ./pip
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: Install Test Python packages
run: python -m pip install -r pip/requirements-test.txt
- name: Test Wheel
run: |
python -m pip install --force-reinstall --no-index --find-links=target/wheels qirrunner
python -m pytest --verbose pip
- name: uninstall qirrunner
run: python -m pip uninstall -y qirrunner
- name: Test sdist
run: |
python -m pip install (Resolve-Path ./target/wheels/qirrunner*.tar.gz)
python -m pytest --verbose pip
shell: pwsh
# qir-stdlib Artifact
- name: Organize qir-stdlib artifacts (all platforms)
run: |
New-Item -Path ./target/stdlib -ItemType Directory -Force
Copy-Item -Path ./stdlib/include/qir_stdlib.h -Destination ./target/stdlib -Force
Copy-Item -Path ./stdlib/NOTICE.txt -Destination ./target/stdlib -Force
Copy-Item -Path LICENSE -Destination ./target/stdlib -Force
shell: pwsh
- name: Organize qir-stdlib artifacts (Linux/Mac)
run: |
Copy-Item -Path ./target/release/libqir_stdlib.a -Destination ./target/stdlib -Force
shell: pwsh
if: ${{ matrix.config.os != 'windows-2019' }}
- name: Organize qir-stdlib artifacts (Windows)
run: |
Copy-Item -Path ./target/release/qir_stdlib.lib -Destination ./target/stdlib -Force
Copy-Item -Path ./stdlib/include/qir_stdlib.def -Destination ./target/stdlib -Force
shell: pwsh
if: ${{ matrix.config.os == 'windows-2019' }}
- name: qir-stdlib Artifact
uses: actions/upload-artifact@v4
with:
name: qir-stdlib-${{ matrix.config.os }}-${{ matrix.config.arch }}-artifacts
path: ./target/stdlib/
- 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: ci
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@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v4
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/github-pages-deploy-action@4.1.7
with:
branch: gh-pages
folder: target/doc
if: github.event_name == 'push' && github.ref == 'refs/heads/main'