| 1 |
name: build |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: [ '**' ] |
| 9 |
schedule: |
| 10 |
# At 23:25 on Thursday. |
| 11 |
- cron: "25 23 * * 4" |
| 12 |
|
| 13 |
jobs: |
| 14 |
test: |
| 15 |
strategy: |
| 16 |
fail-fast: false |
| 17 |
matrix: |
| 18 |
runs-on: [ubuntu-20.04, windows-2022, macos-12] |
| 19 |
toolchain: |
| 20 |
- "1.48" |
| 21 |
- stable |
| 22 |
- nightly |
| 23 |
versions: |
| 24 |
- "" |
| 25 |
- "-Zminimal-versions" |
| 26 |
exclude: |
| 27 |
# `windows-core >= 0.51` uses `edition = "2021"`, but users of the library can can use |
| 28 |
# `windows-core == 0.50` to be rust 1.48 compatible. |
| 29 |
- runs-on: windows-2022 |
| 30 |
toolchain: "1.48" |
| 31 |
versions: "" |
| 32 |
runs-on: ${{ matrix.runs-on }} |
| 33 |
steps: |
| 34 |
- name: Checkout |
| 35 |
uses: actions/checkout@v3 |
| 36 |
- uses: maxim-lobanov/setup-xcode@v1 |
| 37 |
if: matrix.runs-on == 'macos-12' && matrix.toolchain == '1.48' |
| 38 |
with: |
| 39 |
xcode-version: "13.4.1" |
| 40 |
- name: Install Rust |
| 41 |
run: | |
| 42 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update |
| 43 |
rustup default ${{ matrix.toolchain }} |
| 44 |
- name: Update lockfile |
| 45 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 46 |
env: |
| 47 |
RUSTC_BOOTSTRAP: 1 |
| 48 |
- run: cargo test --all-targets |
| 49 |
- run: cargo run --example stress-test |
| 50 |
|
| 51 |
build-wasm: |
| 52 |
strategy: |
| 53 |
fail-fast: false |
| 54 |
matrix: |
| 55 |
versions: |
| 56 |
- "" |
| 57 |
- "-Zminimal-versions" |
| 58 |
toolchain: |
| 59 |
- stable |
| 60 |
- nightly |
| 61 |
include: |
| 62 |
# Without `-Zminimal-versions` a too recent bumpalo version is selected. Newer versions use `edition = "2021"`. |
| 63 |
- versions: "-Zminimal-versions" |
| 64 |
- toolchain: "1.48" |
| 65 |
runs-on: ubuntu-latest |
| 66 |
steps: |
| 67 |
- name: Checkout |
| 68 |
uses: actions/checkout@v3 |
| 69 |
- name: Install Rust |
| 70 |
run: | |
| 71 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target wasm32-unknown-unknown |
| 72 |
rustup default ${{ matrix.toolchain }} |
| 73 |
- name: Update lockfile |
| 74 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 75 |
env: |
| 76 |
RUSTC_BOOTSTRAP: 1 |
| 77 |
- run: cargo build --lib |
| 78 |
|
| 79 |
test-wasm: |
| 80 |
strategy: |
| 81 |
fail-fast: false |
| 82 |
matrix: |
| 83 |
versions: |
| 84 |
- "" |
| 85 |
- "-Zminimal-versions" |
| 86 |
toolchain: |
| 87 |
- stable |
| 88 |
- nightly |
| 89 |
runs-on: ubuntu-latest |
| 90 |
steps: |
| 91 |
- name: Checkout |
| 92 |
uses: actions/checkout@v3 |
| 93 |
- name: Install Rust |
| 94 |
run: | |
| 95 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target wasm32-unknown-unknown |
| 96 |
rustup default ${{ matrix.toolchain }} |
| 97 |
- name: Install Node |
| 98 |
uses: actions/setup-node@v3 |
| 99 |
with: |
| 100 |
node-version: 14 |
| 101 |
- name: Install "wasm-pack" |
| 102 |
uses: taiki-e/install-action@v2 |
| 103 |
with: |
| 104 |
tool: wasm-pack |
| 105 |
- name: Update lockfile |
| 106 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 107 |
env: |
| 108 |
RUSTC_BOOTSTRAP: 1 |
| 109 |
- run: wasm-pack test --node |
| 110 |
|
| 111 |
build-cross: |
| 112 |
strategy: |
| 113 |
fail-fast: false |
| 114 |
matrix: |
| 115 |
target: |
| 116 |
- x86_64-unknown-freebsd |
| 117 |
- x86_64-unknown-illumos |
| 118 |
- x86_64-unknown-netbsd |
| 119 |
- sparcv9-sun-solaris |
| 120 |
versions: |
| 121 |
- "" |
| 122 |
- "-Zminimal-versions" |
| 123 |
runs-on: ubuntu-latest |
| 124 |
steps: |
| 125 |
- name: Checkout |
| 126 |
uses: actions/checkout@v3 |
| 127 |
- name: Install Rust |
| 128 |
run: | |
| 129 |
rustup toolchain install stable --profile minimal --no-self-update --target ${{ matrix.target }} |
| 130 |
- name: Update lockfile |
| 131 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 132 |
env: |
| 133 |
RUSTC_BOOTSTRAP: 1 |
| 134 |
|
| 135 |
- name: Install "cross" |
| 136 |
uses: taiki-e/install-action@v2 |
| 137 |
with: |
| 138 |
tool: cross |
| 139 |
|
| 140 |
- run: cross build --target ${{ matrix.target }} --examples |
| 141 |
|
| 142 |
build-android: |
| 143 |
runs-on: ubuntu-latest |
| 144 |
steps: |
| 145 |
- name: Checkout |
| 146 |
uses: actions/checkout@v3 |
| 147 |
- name: Install Rust |
| 148 |
run: rustup toolchain install stable --profile minimal --no-self-update |
| 149 |
- name: Add Rust components |
| 150 |
run: rustup component add clippy rust-src |
| 151 |
- name: Add Rust toolchain |
| 152 |
run: rustup target add aarch64-linux-android armv7-linux-androideabi |
| 153 |
- name: Setup Android NDK |
| 154 |
uses: nttld/setup-ndk@v1 |
| 155 |
id: setup-ndk |
| 156 |
with: |
| 157 |
ndk-version: r25b |
| 158 |
local-cache: true |
| 159 |
|
| 160 |
- name: Install "cargo ndk" |
| 161 |
uses: taiki-e/install-action@v2 |
| 162 |
with: |
| 163 |
tool: cargo-ndk |
| 164 |
|
| 165 |
- name: Check |
| 166 |
run: cargo ndk check --lib |
| 167 |
env: |
| 168 |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 169 |
|
| 170 |
- name: Clippy |
| 171 |
run: cargo ndk clippy --lib |
| 172 |
env: |
| 173 |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 174 |
|
| 175 |
- name: Build library |
| 176 |
run: cargo ndk build --lib |
| 177 |
env: |
| 178 |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 179 |
|
| 180 |
build-ios-cross: |
| 181 |
strategy: |
| 182 |
fail-fast: false |
| 183 |
matrix: |
| 184 |
toolchain: |
| 185 |
- "1.48" |
| 186 |
- stable |
| 187 |
target: |
| 188 |
- x86_64-apple-ios |
| 189 |
versions: |
| 190 |
- "" |
| 191 |
- "-Zminimal-versions" |
| 192 |
exclude: |
| 193 |
# Support for this target was added quite recently. |
| 194 |
- target: aarch64-apple-ios-sim |
| 195 |
- toolchain: "1.48" |
| 196 |
runs-on: macos-12 |
| 197 |
steps: |
| 198 |
- name: Checkout |
| 199 |
uses: actions/checkout@v3 |
| 200 |
- name: Install Rust |
| 201 |
run: | |
| 202 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target ${{ matrix.target }} |
| 203 |
rustup default ${{ matrix.toolchain }} |
| 204 |
- name: Update lockfile |
| 205 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 206 |
env: |
| 207 |
RUSTC_BOOTSTRAP: 1 |
| 208 |
- name: Install "cross" |
| 209 |
run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5-x86_64-apple-darwin/cross-0.2.5-x86_64-apple-darwin.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin |
| 210 |
- run: cross build --target ${{ matrix.target }} --examples |
| 211 |
|
| 212 |
check: |
| 213 |
strategy: |
| 214 |
fail-fast: false |
| 215 |
matrix: |
| 216 |
toolchain: |
| 217 |
- "1.48" |
| 218 |
- stable |
| 219 |
- nightly |
| 220 |
versions: |
| 221 |
- "" |
| 222 |
- "-Zminimal-versions" |
| 223 |
runs-on: ubuntu-latest |
| 224 |
env: |
| 225 |
RUSTFLAGS: -D warnings |
| 226 |
RUST_BACKTRACE: 1 |
| 227 |
steps: |
| 228 |
- name: Checkout |
| 229 |
uses: actions/checkout@v3 |
| 230 |
- name: Install Rust |
| 231 |
run: | |
| 232 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --component clippy |
| 233 |
rustup default ${{ matrix.toolchain }} |
| 234 |
- name: Update lockfile |
| 235 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 236 |
env: |
| 237 |
RUSTC_BOOTSTRAP: 1 |
| 238 |
- run: cargo check --all-targets |
| 239 |
- run: cargo clippy --all-targets |
| 240 |
|
| 241 |
no-docker-image-check-only: |
| 242 |
runs-on: ubuntu-latest |
| 243 |
steps: |
| 244 |
- name: Checkout |
| 245 |
uses: actions/checkout@v3 |
| 246 |
- name: Install Rust |
| 247 |
run: | |
| 248 |
rustup toolchain install nightly --profile minimal --no-self-update --component rust-src |
| 249 |
rustup default nightly |
| 250 |
- run: cargo check --target x86_64-unknown-haiku -Z build-std --examples |
| 251 |
|
| 252 |
doc: |
| 253 |
runs-on: ubuntu-latest |
| 254 |
steps: |
| 255 |
- name: Checkout |
| 256 |
uses: actions/checkout@v3 |
| 257 |
- name: Install Rust |
| 258 |
run: | |
| 259 |
rustup toolchain install nightly --profile minimal --no-self-update |
| 260 |
rustup default nightly |
| 261 |
- run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features |
| 262 |
|
| 263 |
audit: |
| 264 |
runs-on: ubuntu-latest |
| 265 |
steps: |
| 266 |
- name: Checkout |
| 267 |
uses: actions/checkout@v3 |
| 268 |
- name: Audit |
| 269 |
uses: rustsec/[email protected] |
| 270 |
with: |
| 271 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 272 |
|
| 273 |
fallback: |
| 274 |
runs-on: ubuntu-latest |
| 275 |
steps: |
| 276 |
- name: Checkout |
| 277 |
uses: actions/checkout@v3 |
| 278 |
- name: Install Rust |
| 279 |
run: | |
| 280 |
rustup toolchain install stable --profile minimal --no-self-update --target x86_64-fortanix-unknown-sgx |
| 281 |
# Should fail (outcome is negated): |
| 282 |
- run: if cargo build --lib --target x86_64-fortanix-unknown-sgx; then exit 1; fi |
| 283 |
# Should succeed: |
| 284 |
- run: cargo build --lib --target x86_64-fortanix-unknown-sgx --features fallback |
| 285 |
|
| 286 |
c: |
| 287 |
name: Lint and format C |
| 288 |
runs-on: ubuntu-latest |
| 289 |
steps: |
| 290 |
- name: Checkout repository |
| 291 |
uses: actions/checkout@v3 |
| 292 |
|
| 293 |
- name: Setup Node.js runtime |
| 294 |
uses: actions/setup-node@v3 |
| 295 |
with: |
| 296 |
node-version: 16 |
| 297 |
|
| 298 |
- name: Install npm |
| 299 |
run: npm i -f -g [email protected] |
| 300 |
|
| 301 |
- name: Lint and check formatting with clang-format |
| 302 |
run: npx github:artichoke/clang-format --check |
| 303 |
|
| 304 |
test-haiku: |
| 305 |
strategy: |
| 306 |
fail-fast: false |
| 307 |
matrix: |
| 308 |
runs-on: [ubuntu-20.04, windows-2022, macos-12] |
| 309 |
toolchain: |
| 310 |
- stable |
| 311 |
versions: |
| 312 |
- "" |
| 313 |
runs-on: ${{ matrix.runs-on }} |
| 314 |
env: |
| 315 |
RUSTFLAGS: -D warnings |
| 316 |
RUST_BACKTRACE: 1 |
| 317 |
steps: |
| 318 |
- name: Checkout |
| 319 |
uses: actions/checkout@v3 |
| 320 |
- name: Install Rust |
| 321 |
run: | |
| 322 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target x86_64-fortanix-unknown-sgx |
| 323 |
rustup default ${{ matrix.toolchain }} |
| 324 |
- name: Update lockfile |
| 325 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 326 |
working-directory: haiku |
| 327 |
env: |
| 328 |
RUSTC_BOOTSTRAP: 1 |
| 329 |
- run: cargo test --all-targets |
| 330 |
working-directory: haiku |
| 331 |
|
| 332 |
check-haiku: |
| 333 |
strategy: |
| 334 |
fail-fast: false |
| 335 |
matrix: |
| 336 |
toolchain: |
| 337 |
- stable |
| 338 |
versions: |
| 339 |
- "" |
| 340 |
runs-on: ubuntu-latest |
| 341 |
env: |
| 342 |
RUSTFLAGS: -D warnings |
| 343 |
RUST_BACKTRACE: 1 |
| 344 |
steps: |
| 345 |
- name: Checkout |
| 346 |
uses: actions/checkout@v3 |
| 347 |
- name: Install Rust |
| 348 |
run: | |
| 349 |
rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --component clippy |
| 350 |
rustup default ${{ matrix.toolchain }} |
| 351 |
- name: Update lockfile |
| 352 |
run: cargo generate-lockfile ${{ matrix.versions }} |
| 353 |
working-directory: haiku |
| 354 |
env: |
| 355 |
RUSTC_BOOTSTRAP: 1 |
| 356 |
- run: cargo check --all-targets |
| 357 |
working-directory: haiku |
| 358 |
- run: cargo clippy --all-targets |
| 359 |
working-directory: haiku |
| 360 |
|
| 361 |
check-all-versions: |
| 362 |
runs-on: ubuntu-20.04 |
| 363 |
steps: |
| 364 |
- name: Checkout |
| 365 |
uses: actions/checkout@v3 |
| 366 |
|
| 367 |
- name: Install Rust |
| 368 |
run: | |
| 369 |
rustup toolchain install nightly --profile minimal --no-self-update |
| 370 |
rustup default nightly |
| 371 |
|
| 372 |
- name: Install "cargo hack" |
| 373 |
uses: taiki-e/install-action@v2 |
| 374 |
with: |
| 375 |
tool: cargo-hack |
| 376 |
|
| 377 |
- run: cargo hack check --version-range 1.36.. --version-step 2 --clean-per-version --clean-per-run |
| 378 |
|
| 379 |
generate-windows-bindings: |
| 380 |
name: Generate windows-core bindings with windows-bindgen |
| 381 |
runs-on: ubuntu-latest |
| 382 |
steps: |
| 383 |
- uses: actions/checkout@v3 |
| 384 |
- name: Clean |
| 385 |
run: rm -rf src/Windows.rs |
| 386 |
- name: Generate |
| 387 |
run: cargo r --manifest-path=api_gen/Cargo.toml |
| 388 |
- name: Diff generated Rust code |
| 389 |
run: test -z "$(git status --porcelain)" || (echo "::error::Generated files are different, please regenerate with cargo run --manifest-path=api_gen/Cargo.toml!"; git status; false) |