88 push :
99 branches :
1010 - main
11- - v4.x
12- env :
11+
12+ env :
1313 RUSTFLAGS : -Dwarnings
1414 RUST_BACKTRACE : 1
15+ CARGO_INCREMENTAL : 0
16+ CARGO_PROFILE_DEV_DEBUG : 0
1517
1618jobs :
1719 rustfmt :
@@ -27,44 +29,41 @@ jobs:
2729 clippy :
2830 name : clippy
2931 runs-on : ubuntu-latest
32+ env :
33+ CARGO_HOME : ${{ github.workspace }}/.cache/cargo
3034 steps :
3135 - uses : actions/checkout@v4
3236 with :
3337 submodules : ' recursive'
3438 - name : Install Rust
35- run : rustup update --no-self-update stable && rustup default stable && rustup component add clippy
39+ run : rustup toolchain add stable --no-self-update --component clippy && rustup default stable
3640 - name : Get rust version
3741 id : rust-version
42+ shell : bash
3843 run : |
3944 echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
4045 - name : Cache cargo index
4146 uses : actions/cache@v4
4247 with :
43- path : ~/.cargo/registry/index
44- key : index-${{ runner.os }}-${{ github.run_number }}
45- restore-keys : |
46- index-${{ runner.os }}-
47- - name : Create lockfile
48- run : cargo generate-lockfile
49- - name : Cache cargo registry
50- uses : actions/cache@v4
51- with :
52- path : ~/.cargo/registry/cache
53- key : registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
48+ path : |
49+ .cache/cargo/registry/index
50+ .cache/cargo/registry/cache
51+ key : index-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
52+ enableCrossOsArchive : true
5453 - name : Fetch dependencies
5554 run : cargo fetch
5655 - name : Cache target directory
5756 uses : actions/cache@v4
5857 with :
5958 path : target
60- key : clippy-target-${{ runner.os }}- ${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
59+ key : clippy-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
6160 - name : Run clippy
6261 run : cargo clippy --all --all-targets
6362 - name : Check docs
64- run : cargo doc --no-deps -p boring -p boring-sys -- features rpk,pq-experimental ,underscore-wildcards
63+ run : cargo doc --no-deps -p boring -p boring-sys -p hyper-boring -p tokio-boring -- features rpk,underscore-wildcards
6564 env :
6665 CARGO_BUILD_RUSTDOCFLAGS : " --cfg=docsrs"
67- RUST_BOOTSTRAP : 1
66+ RUSTC_BOOTSTRAP : 1
6867 DOCS_RS : 1
6968 - name : Cargo.toml boring versions consistency
7069 shell : bash
8281 matrix :
8382 thing :
8483 - stable
84+ - i686-mingw
8585 - arm-android
8686 - arm64-android
8787 - i686-android
@@ -121,6 +121,8 @@ jobs:
121121 rust : stable
122122 os : ubuntu-latest
123123 check_only : true
124+ custom_env :
125+ CXXFLAGS : -msse2
124126 - thing : x86_64-android
125127 target : x86_64-linux-android
126128 rust : stable
@@ -151,6 +153,8 @@ jobs:
151153 rust : stable
152154 os : ubuntu-latest
153155 apt_packages : gcc-multilib g++-multilib
156+ custom_env :
157+ CXXFLAGS : -msse2
154158 - thing : arm-linux
155159 target : arm-unknown-linux-gnueabi
156160 rust : stable
@@ -191,29 +195,64 @@ jobs:
191195 C_INCLUDE_PATH : " C:\\ msys64\\ usr\\ include"
192196 CPLUS_INCLUDE_PATH : " C:\\ msys64\\ usr\\ include"
193197 LIBRARY_PATH : " C:\\ msys64\\ usr\\ lib"
198+ RUSTC_BOOTSTRAP : 1 # for -Z checksum-freshness
199+ # CI's Windows doesn't have required root certs
200+ extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
201+ - thing : i686-mingw
202+ target : i686-pc-windows-gnu
203+ rust : stable
204+ os : windows-latest
205+ check_only : true
206+ custom_env :
207+ RUSTC_BOOTSTRAP : 1 # for -Z checksum-freshness
208+ CMAKE_GENERATOR : " MinGW Makefiles"
209+ COLLECT_GCC : null
194210 # CI's Windows doesn't have required root certs
195- extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring
211+ extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
196212 - thing : i686-msvc
197213 target : i686-pc-windows-msvc
198214 rust : stable-x86_64-msvc
199215 os : windows-latest
216+ custom_env :
217+ RUSTC_BOOTSTRAP : 1 # for -Z checksum-freshness
218+ CXXFLAGS : -msse2
200219 # CI's Windows doesn't have required root certs
201- extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring
220+ extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
202221 - thing : x86_64-msvc
203222 target : x86_64-pc-windows-msvc
204223 rust : stable-x86_64-msvc
205224 os : windows-latest
225+ custom_env :
226+ RUSTC_BOOTSTRAP : 1 # for -Z checksum-freshness
206227 # CI's Windows doesn't have required root certs
207- extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring
208-
228+ extra_test_args : --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
229+ env :
230+ CARGO_HOME : ${{ github.workspace }}/.cache/cargo
231+ CARGO_BUILD_BUILD_DIR : ${{ github.workspace }}/.cache/build-dir
209232 steps :
210233 - uses : actions/checkout@v4
211234 with :
212235 submodules : ' recursive'
213236 - name : Install Rust (rustup)
214- run : rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
237+ run : rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }}
215238 shell : bash
216- - run : rustup target add ${{ matrix.target }}
239+ - name : Get rust version
240+ id : rust-version
241+ shell : bash
242+ run : |
243+ echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
244+ - name : Prepopulate cargo index
245+ uses : actions/cache/restore@v4
246+ with :
247+ path : |
248+ .cache/cargo/registry/index
249+ .cache/cargo/registry/cache
250+ key : index-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
251+ enableCrossOsArchive : true
252+ - name : Install golang
253+ uses : actions/setup-go@v5
254+ with :
255+ go-version : ' >=1.22.0'
217256 - name : Install target-specific APT dependencies
218257 if : " matrix.apt_packages != ''"
219258 run : sudo apt update && sudo apt install -y ${{ matrix.apt_packages }}
@@ -222,6 +261,32 @@ jobs:
222261 if : startsWith(matrix.os, 'windows')
223262 run : choco install nasm
224263 shell : cmd
264+ - name : Setup 32-bit MSYS2
265+ if : matrix.thing == 'i686-mingw'
266+ uses : msys2/setup-msys2@v2
267+ id : msys2
268+ with :
269+ msystem : MINGW32
270+ path-type : inherit
271+ install : >-
272+ mingw-w64-i686-gcc
273+ mingw-w64-i686-cmake
274+ - name : Setup 32-bit MSYS2 Env vars
275+ if : matrix.thing == 'i686-mingw'
276+ shell : bash
277+ run : |
278+ MSYS_ROOT='${{ steps.msys2.outputs.msys2-location }}'
279+ test -d "$MSYS_ROOT\\mingw32\\bin"
280+ echo >> $GITHUB_PATH "$MSYS_ROOT\\mingw32\\bin"
281+ echo >> $GITHUB_PATH "$MSYS_ROOT\\usr\\bin"
282+ echo >> $GITHUB_ENV CC="$MSYS_ROOT\\mingw32\\bin\\gcc"
283+ echo >> $GITHUB_ENV CXX="$MSYS_ROOT\\mingw32\\bin\\g++"
284+ echo >> $GITHUB_ENV AR="$MSYS_ROOT\\mingw32\\bin\\ar"
285+ echo >> $GITHUB_ENV CFLAGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
286+ echo >> $GITHUB_ENV CXXFLAGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
287+ echo >> $GITHUB_ENV BINDGEN_EXTRA_CLANG_ARGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
288+ echo >> $GITHUB_ENV LIBRARY_PATH="$MSYS_ROOT\\mingw32\\lib"
289+ echo >> $GITHUB_ENV LDFLAGS="-L$MSYS_ROOT\\mingw32\\lib"
225290 - name : Install LLVM and Clang
226291 if : startsWith(matrix.os, 'windows')
227292 uses : KyleMayes/install-llvm-action@v1
@@ -234,12 +299,31 @@ jobs:
234299 - name : Set Android Linker path
235300 if : endsWith(matrix.thing, '-android')
236301 run : echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" >> "$GITHUB_ENV"
302+ - name : Fetch deps
303+ run : cargo fetch --target ${{ matrix.target }}
304+ shell : bash
305+ env : ${{ matrix.custom_env }}
306+ # Windows builds are the slowest
307+ - name : Cache deps in Windows tests
308+ if : startsWith(matrix.os, 'windows')
309+ uses : actions/cache/restore@v4
310+ id : test-cache-restore
311+ with :
312+ path : .cache/build-dir
313+ key : wintest-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
237314 - name : Build tests
238315 # We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets.
239- run : cargo build --target ${{ matrix.target }} --tests ${{ matrix.extra_test_args }}
316+ run : cargo build -vv - -target ${{ matrix.target }} --tests ${{ matrix.extra_test_args }}
240317 shell : bash
241318 env : ${{ matrix.custom_env }}
242- - name : Run tests
319+ # By default it'd be saved after later cargo calls, which already invalidated the cache
320+ - name : Cache deps in Windows tests
321+ if : startsWith(matrix.os, 'windows')
322+ uses : actions/cache/save@v4
323+ with :
324+ path : .cache/build-dir
325+ key : ${{ steps.test-cache-restore.outputs.cache-primary-key }}
326+ - name : Run tests (skip=${{ matrix.check_only }})
243327 if : " !matrix.check_only"
244328 run : cargo test --target ${{ matrix.target }} ${{ matrix.extra_test_args }}
245329 shell : bash
@@ -255,7 +339,9 @@ jobs:
255339 #
256340 # Both of these may no longer be the case after updating the BoringSSL
257341 # submodules to a new revision, so it's important to test this on CI.
258- run : cargo publish --dry-run -p boring-sys
342+ run : cargo publish --dry-run --target ${{ matrix.target }} -p boring-sys
343+ shell : bash
344+ env : ${{ matrix.custom_env }}
259345
260346 test-fips :
261347 name : Test FIPS integration
@@ -267,18 +353,10 @@ jobs:
267353 - name : Install Rust (rustup)
268354 run : rustup update stable --no-self-update && rustup default stable
269355 shell : bash
270- - name : Install Clang-12
271- uses : KyleMayes/install-llvm-action@v1
272- with :
273- version : " 12.0.0"
274- directory : ${{ runner.temp }}/llvm
275356 - name : Install golang
276357 uses : actions/setup-go@v5
277358 with :
278359 go-version : ' >=1.22.0'
279- - name : Add clang++-12 link
280- working-directory : ${{ runner.temp }}/llvm/bin
281- run : ln -s clang clang++-12
282360 - name : Run tests
283361 run : cargo test --features fips
284362 - name : Test boring-sys cargo publish (FIPS)
@@ -306,21 +384,30 @@ jobs:
306384 with :
307385 submodules : ' recursive'
308386 - name : Install Rust (rustup)
309- run : rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.target }}
387+ run : rustup toolchain install stable --no-self-update --profile minimal -- target ${{ matrix.target }} && rustup default stable
310388 shell : bash
389+ - name : Install golang
390+ uses : actions/setup-go@v5
391+ with :
392+ go-version : ' >=1.22.0'
311393 - name : Install ${{ matrix.target }} toolchain
312394 run : brew tap messense/macos-cross-toolchains && brew install ${{ matrix.target }}
313395 - name : Set BORING_BSSL_SYSROOT
314396 run : echo "BORING_BSSL_SYSROOT=$(brew --prefix ${{ matrix.target }})/toolchain/${{ matrix.target }}/sysroot" >> $GITHUB_ENV
315397 shell : bash
316398 - name : Set CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER
317399 run : echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=${{ matrix.target }}-gcc" >> $GITHUB_ENV
400+ shell : bash
401+ - name : Set CXXFLAGS
402+ run : echo "CXXFLAGS=-D__STDC_FORMAT_MACROS" >> $GITHUB_ENV
318403 - name : Build for ${{ matrix.target }}
319404 run : cargo build --target ${{ matrix.target }} --all-targets
320405
321406 test-features :
322407 name : Test features
323408 runs-on : ubuntu-latest
409+ env :
410+ CARGO_INCREMENTAL : 1
324411 steps :
325412 - uses : actions/checkout@v4
326413 with :
@@ -330,19 +417,7 @@ jobs:
330417 shell : bash
331418 - run : cargo test --features rpk
332419 name : Run `rpk` tests
333- - run : cargo test --features pq-experimental
334- name : Run `pq-experimental` tests
335420 - run : cargo test --features underscore-wildcards
336421 name : Run `underscore-wildcards` tests
337- - run : cargo test --features pq-experimental,rpk
338- name : Run `pq-experimental,rpk` tests
339- - run : cargo test --features kx-safe-default,pq-experimental
340- name : Run `kx-safe-default` tests
341- - run : cargo test --features pq-experimental,underscore-wildcards
342- name : Run `pq-experimental,underscore-wildcards` tests
343422 - run : cargo test --features rpk,underscore-wildcards
344423 name : Run `rpk,underscore-wildcards` tests
345- - run : cargo test --features pq-experimental,rpk,underscore-wildcards
346- name : Run `pq-experimental,rpk,underscore-wildcards` tests
347- - run : cargo test -p hyper-boring --features hyper1
348- name : Run hyper 1.0 tests for hyper-boring
0 commit comments