-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect target-cpu in RUSTFLAGS (#243)
* Respect target-cpu in RUSTFLAGS Signed-off-by: Wish <[email protected]> * Raise rustc requirement from 1.70 to 1.74 Signed-off-by: Wish <[email protected]> * Fix bindgen errors Signed-off-by: Wish <[email protected]> * Fix CI in set -e Signed-off-by: Wish <[email protected]> * Use pre-built x86-instruction-set-analyzer Signed-off-by: Wish <[email protected]> --------- Signed-off-by: Wish <[email protected]> Co-authored-by: messense <[email protected]>
- Loading branch information
1 parent
6f7e133
commit 841df51
Showing
7 changed files
with
386 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,11 @@ jobs: | |
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }} | ||
matrix: | ||
os: [ubuntu-latest, macos-13, windows-latest] | ||
toolchain: [1.70.0, stable, nightly] | ||
toolchain: [1.74.0, stable, nightly] | ||
zig: [0.10.1, 0.12.0, master] | ||
exclude: | ||
# Only test MSRV with zig stable version | ||
- toolchain: 1.70.0 | ||
- toolchain: 1.74.0 | ||
zig: master | ||
env: | ||
RUST_BACKTRACE: "1" | ||
|
@@ -81,6 +81,41 @@ jobs: | |
cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target aarch64-unknown-linux-gnu | ||
cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target x86_64-pc-windows-gnu | ||
cargo run zigbuild --manifest-path tests/bindgen-exhaustive/Cargo.toml --target aarch64-apple-darwin | ||
- name: Install x86-instruction-set-analyzer | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
- name: Test RUSTFLAGS | ||
shell: bash | ||
run: | | ||
set -e | ||
cargo build # Build without RUSTFLAGS | ||
echo "Running -C target_cpu=x86-64..." | ||
echo | ||
export RUSTFLAGS="-C target_cpu=x86-64" | ||
target/debug/cargo-zigbuild zigbuild --manifest-path tests/target-cpu/Cargo.toml --target x86_64-unknown-linux-gnu --release | ||
x86-instruction-set-analyzer tests/target-cpu/target/x86_64-unknown-linux-gnu/release/target-cpu | tee output.txt | ||
echo | ||
if grep -q 'AVX2' output.txt; then | ||
echo "Test fail, should not contain AVX2 instruction set" | ||
false | ||
else | ||
echo "Test pass" | ||
fi | ||
echo "Running -C target_cpu=x86-64-v4..." | ||
echo | ||
export RUSTFLAGS="-C target_cpu=x86-64-v4" | ||
target/debug/cargo-zigbuild zigbuild --manifest-path tests/target-cpu/Cargo.toml --target x86_64-unknown-linux-gnu --release | ||
x86-instruction-set-analyzer tests/target-cpu/target/x86_64-unknown-linux-gnu/release/target-cpu | tee output.txt | ||
echo | ||
if ! grep -q 'AVX2' output.txt; then | ||
echo "Test fail, should contain AVX2 instruction set" | ||
false | ||
else | ||
echo "Test pass" | ||
fi | ||
- name: macOS - Test build | ||
run: | | ||
cargo run zigbuild --target aarch64-apple-darwin | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.