Skip to content

Commit eea888e

Browse files
committed
update config portable
1 parent 49c2063 commit eea888e

2 files changed

Lines changed: 33 additions & 6 deletions

File tree

.github/build-setup.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
set -euo pipefail
55
cp .cargo/config-portable.toml .cargo/config.toml
66
7-
- name: Verify runner CPU + AVX2 visibility
7+
- name: Verify runner AVX2 visibility (x86_64 only)
8+
if: contains(join(matrix.targets, ','), 'x86_64-')
89
shell: bash
910
run: |
1011
set -euo pipefail
@@ -14,12 +15,25 @@
1415
lscpu | grep -qi avx2
1516
else
1617
sysctl -n machdep.cpu.brand_string || true
17-
sysctl -n machdep.cpu.features | grep -q AVX2
18+
(sysctl -n machdep.cpu.features 2>/dev/null; sysctl -n machdep.cpu.leaf7_features 2>/dev/null) \
19+
| tr ' ' '\n' | grep -q AVX2
1820
fi
1921
20-
- name: Force AVX2 for x86_64
22+
- name: Force AVX2 for x86_64 targets
23+
if: contains(join(matrix.targets, ','), 'x86_64-')
2124
shell: bash
2225
run: |
2326
set -euo pipefail
2427
echo 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
2528
echo 'CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
29+
30+
- name: Confirm rustc sees AVX2 cfg (x86_64 only)
31+
if: contains(join(matrix.targets, ','), 'x86_64-')
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
if [[ "$RUNNER_OS" == "Linux" ]]; then
36+
rustc --print cfg --target x86_64-unknown-linux-gnu | grep 'target_feature="avx2"'
37+
else
38+
rustc --print cfg --target x86_64-apple-darwin | grep 'target_feature="avx2"'
39+
fi

.github/workflows/release.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ jobs:
132132
set -euo pipefail
133133
cp .cargo/config-portable.toml .cargo/config.toml
134134
shell: "bash"
135-
- name: "Verify runner CPU + AVX2 visibility"
135+
- name: "Verify runner AVX2 visibility (x86_64 only)"
136+
if: "contains(join(matrix.targets, ','), 'x86_64-')"
136137
run: |
137138
set -euo pipefail
138139
uname -m
@@ -141,15 +142,27 @@ jobs:
141142
lscpu | grep -qi avx2
142143
else
143144
sysctl -n machdep.cpu.brand_string || true
144-
sysctl -n machdep.cpu.features | grep -q AVX2
145+
(sysctl -n machdep.cpu.features 2>/dev/null; sysctl -n machdep.cpu.leaf7_features 2>/dev/null) \
146+
| tr ' ' '\n' | grep -q AVX2
145147
fi
146148
shell: "bash"
147-
- name: "Force AVX2 for x86_64"
149+
- name: "Force AVX2 for x86_64 targets"
150+
if: "contains(join(matrix.targets, ','), 'x86_64-')"
148151
run: |
149152
set -euo pipefail
150153
echo 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
151154
echo 'CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS=-C target-cpu=x86-64-v3 -C target-feature=+avx2' >> "$GITHUB_ENV"
152155
shell: "bash"
156+
- name: "Confirm rustc sees AVX2 cfg (x86_64 only)"
157+
if: "contains(join(matrix.targets, ','), 'x86_64-')"
158+
run: |
159+
set -euo pipefail
160+
if [[ "$RUNNER_OS" == "Linux" ]]; then
161+
rustc --print cfg --target x86_64-unknown-linux-gnu | grep 'target_feature="avx2"'
162+
else
163+
rustc --print cfg --target x86_64-apple-darwin | grep 'target_feature="avx2"'
164+
fi
165+
shell: "bash"
153166
- name: Install dist
154167
run: ${{ matrix.install_dist.run }}
155168
# Get the dist-manifest

0 commit comments

Comments
 (0)