-
Notifications
You must be signed in to change notification settings - Fork 694
254 lines (218 loc) · 7.88 KB
/
bindgen.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
name: bindgen
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
branches:
- main
jobs:
rustfmt-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
# TODO: Should ideally be stable, but we use some nightly-only
# features.
toolchain: nightly
components: rustfmt, clippy
- name: Run rustfmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy --tests
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install msrv for lib
uses: dtolnay/rust-toolchain@master
with:
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
- name: Test lib with msrv
run: cargo +1.70.0 test --package bindgen
- name: Install msrv for cli
uses: dtolnay/rust-toolchain@master
with:
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
- name: Test cli with msrv
run: cargo +1.70.0 build --package bindgen-cli
minimal:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Check without default features
run: cargo check -p bindgen --no-default-features --features=runtime
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Generate documentation for `bindgen`
run: cargo doc --document-private-items --no-deps -p bindgen
- name: Generate documentation for `bindgen-cli`
run: cargo doc --document-private-items --no-deps -p bindgen-cli
quickchecking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
# TODO: Actually run quickchecks once `bindgen` is reliable enough.
- name: Build quickcheck tests
run: cd bindgen-tests/tests/quickchecking && cargo test
test-expectations:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Test expectations
run: cd bindgen-tests/tests/expectations && cargo test
test:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
target:
- debian: null
cross: null
rust: null
llvm_version: ["9.0", "16.0"]
main_tests: [1]
release_build: [0, 1]
no_default_features: [0, 1]
# FIXME: There are no pre-built static libclang libraries, so the
# `static` feature is not testable atm.
feature_runtime: [0, 1]
feature_extra_asserts: [0]
include:
# Test with extra asserts + docs just with latest llvm versions to
# prevent explosion
- os: ubuntu-latest
llvm_version: "16.0"
release_build: 0
no_default_features: 0
feature_extra_asserts: 1
# FIXME: Seems installing multiarch packages fails:
#
# https://github.com/rust-lang/rust-bindgen/pull/2037/checks?check_run_id=2441799333
#
# - os: ubuntu-latest
# target:
# debian: arm64
# cross: aarch64-linux-gnu
# rust: aarch64-unknown-linux-gnu
# llvm_version: "16.0"
# main_tests: 0
# release_build: 0
# feature_extra_asserts: 0
# Ensure stuff works on macos too
# FIXME: Ideally should use the latest llvm version, but llvm doesn't
# provide releases for x86-64 macOS anymore which is what the runner uses.
#
- os: macos-12
llvm_version: "9.0"
release_build: 0
no_default_features: 0
feature_extra_asserts: 0
steps:
- uses: actions/checkout@v4
- name: Install multiarch packages
if: matrix.target.debian
run: |
sudo apt-get install binfmt-support qemu-user-static gcc-${{matrix.target.cross}} g++-${{matrix.target.cross}}
source /etc/lsb-release
sudo tee /etc/apt/sources.list <<EOF >/dev/null
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-updates main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-backports main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-security main
EOF
sudo dpkg --add-architecture ${{matrix.target.debian}}
sudo apt-get update
sudo apt-get install libc6:${{matrix.target.debian}} libstdc++6:${{matrix.target.debian}}
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{matrix.target.rust}}
- name: Install libtinfo
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libtinfo5
- name: Run all the tests
env:
GITHUB_ACTIONS_OS: ${{matrix.os}}
RUST_CROSS_COMPILER: ${{matrix.target.cross}}
RUST_TARGET: ${{matrix.target.rust}}
LLVM_VERSION: ${{matrix.llvm_version}}
BINDGEN_MAIN_TESTS: ${{matrix.main_tests}}
BINDGEN_RELEASE_BUILD: ${{matrix.release_build}}
BINDGEN_FEATURE_RUNTIME: ${{matrix.feature_runtime}}
BINDGEN_FEATURE_EXTRA_ASSERTS: ${{matrix.feature_extra_asserts}}
BINDGEN_NO_DEFAULT_FEATURES: ${{matrix.no_default_features}}
run: ./ci/test.sh
check-cfg:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Check cfg
run: cargo check -Z unstable-options -Z check-cfg
test-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# NOTE(emilio): Change deploy-book as well if you change this.
- name: Test book
run: |
curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar xz
./mdbook build book
./mdbook test book
# One job that "summarizes" the success state of this pipeline. This can then
# be added to branch protection, rather than having to add each job
# separately.
success:
runs-on: ubuntu-latest
needs: [rustfmt-clippy, msrv, minimal, docs, quickchecking, test-expectations, test, check-cfg, test-book]
# GitHub branch protection is exceedingly silly and treats "jobs skipped
# because a dependency failed" as success. So we have to do some
# contortions to ensure the job fails if any of its dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'