Skip to content

Commit bba891b

Browse files
committed
Improve test and release coverage for x86
1 parent a6d21b4 commit bba891b

File tree

2 files changed

+92
-40
lines changed

2 files changed

+92
-40
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ jobs:
9292
arch: x86_64
9393
ext: tar.gz
9494

95+
- target: i686-unknown-linux-gnu
96+
os: ubuntu-22.04
97+
platform: linux
98+
arch: x86
99+
ext: tar.gz
100+
95101
- target: aarch64-unknown-linux-gnu
96102
os: ubuntu-22.04-arm
97103
platform: linux
@@ -110,6 +116,12 @@ jobs:
110116
arch: x86_64
111117
ext: zip
112118

119+
- target: i686-pc-windows-msvc
120+
os: windows-2022
121+
platform: windows
122+
arch: x86
123+
ext: zip
124+
113125
- target: aarch64-pc-windows-msvc
114126
os: windows-11-arm
115127
platform: windows
@@ -124,21 +136,30 @@ jobs:
124136
with:
125137
toolchain: stable
126138

127-
- name: Build release binaries
128-
run: cargo build --all-features --release
139+
- name: Install cross
140+
if: matrix.target == 'i686-unknown-linux-gnu'
141+
run: cargo install cross --git https://github.com/cross-rs/cross
142+
143+
- name: Build release binaries (native)
144+
if: matrix.target != 'i686-unknown-linux-gnu'
145+
run: cargo build --all-features --release --target ${{ matrix.target }}
146+
147+
- name: Build release binaries (cross)
148+
if: matrix.target == 'i686-unknown-linux-gnu'
149+
run: cross build --all-features --release --target ${{ matrix.target }}
129150

130151
- name: Verify library files (Unix)
131152
if: runner.os != 'Windows'
132153
shell: bash
133154
run: |
134155
echo "Verifying library files..."
135156
if [ "${{ matrix.platform }}" = "linux" ]; then
136-
test -f target/release/libcrc_fast.so || { echo "Missing libcrc_fast.so"; exit 1; }
137-
test -f target/release/libcrc_fast.a || { echo "Missing libcrc_fast.a"; exit 1; }
157+
test -f target/${{ matrix.target }}/release/libcrc_fast.so || { echo "Missing libcrc_fast.so"; exit 1; }
158+
test -f target/${{ matrix.target }}/release/libcrc_fast.a || { echo "Missing libcrc_fast.a"; exit 1; }
138159
echo "✓ Found libcrc_fast.so and libcrc_fast.a"
139160
elif [ "${{ matrix.platform }}" = "macos" ]; then
140-
test -f target/release/libcrc_fast.dylib || { echo "Missing libcrc_fast.dylib"; exit 1; }
141-
test -f target/release/libcrc_fast.a || { echo "Missing libcrc_fast.a"; exit 1; }
161+
test -f target/${{ matrix.target }}/release/libcrc_fast.dylib || { echo "Missing libcrc_fast.dylib"; exit 1; }
162+
test -f target/${{ matrix.target }}/release/libcrc_fast.a || { echo "Missing libcrc_fast.a"; exit 1; }
142163
echo "✓ Found libcrc_fast.dylib and libcrc_fast.a"
143164
fi
144165
@@ -147,15 +168,15 @@ jobs:
147168
shell: pwsh
148169
run: |
149170
Write-Host "Verifying library files..."
150-
if (-not (Test-Path "target/release/crc_fast.dll")) {
171+
if (-not (Test-Path "target/${{ matrix.target }}/release/crc_fast.dll")) {
151172
Write-Error "Missing crc_fast.dll"
152173
exit 1
153174
}
154-
if (-not (Test-Path "target/release/crc_fast.dll.lib")) {
175+
if (-not (Test-Path "target/${{ matrix.target }}/release/crc_fast.dll.lib")) {
155176
Write-Error "Missing crc_fast.dll.lib"
156177
exit 1
157178
}
158-
if (-not (Test-Path "target/release/crc_fast.lib")) {
179+
if (-not (Test-Path "target/${{ matrix.target }}/release/crc_fast.lib")) {
159180
Write-Error "Missing crc_fast.lib"
160181
exit 1
161182
}
@@ -166,25 +187,25 @@ jobs:
166187
shell: bash
167188
run: |
168189
echo "Verifying CLI binaries..."
169-
test -f target/release/checksum || { echo "Missing checksum"; exit 1; }
170-
test -f target/release/arch-check || { echo "Missing arch-check"; exit 1; }
171-
test -f target/release/get-custom-params || { echo "Missing get-custom-params"; exit 1; }
190+
test -f target/${{ matrix.target }}/release/checksum || { echo "Missing checksum"; exit 1; }
191+
test -f target/${{ matrix.target }}/release/arch-check || { echo "Missing arch-check"; exit 1; }
192+
test -f target/${{ matrix.target }}/release/get-custom-params || { echo "Missing get-custom-params"; exit 1; }
172193
echo "✓ Found checksum, arch-check, and get-custom-params"
173194
174195
- name: Verify CLI binaries (Windows)
175196
if: runner.os == 'Windows'
176197
shell: pwsh
177198
run: |
178199
Write-Host "Verifying CLI binaries..."
179-
if (-not (Test-Path "target/release/checksum.exe")) {
200+
if (-not (Test-Path "target/${{ matrix.target }}/release/checksum.exe")) {
180201
Write-Error "Missing checksum.exe"
181202
exit 1
182203
}
183-
if (-not (Test-Path "target/release/arch-check.exe")) {
204+
if (-not (Test-Path "target/${{ matrix.target }}/release/arch-check.exe")) {
184205
Write-Error "Missing arch-check.exe"
185206
exit 1
186207
}
187-
if (-not (Test-Path "target/release/get-custom-params.exe")) {
208+
if (-not (Test-Path "target/${{ matrix.target }}/release/get-custom-params.exe")) {
188209
Write-Error "Missing get-custom-params.exe"
189210
exit 1
190211
}
@@ -202,16 +223,16 @@ jobs:
202223
mkdir -p "$PKG_NAME/bin"
203224
204225
echo "Copying library files..."
205-
cp target/release/libcrc_fast.so "$PKG_NAME/lib/"
206-
cp target/release/libcrc_fast.a "$PKG_NAME/lib/"
226+
cp target/${{ matrix.target }}/release/libcrc_fast.so "$PKG_NAME/lib/"
227+
cp target/${{ matrix.target }}/release/libcrc_fast.a "$PKG_NAME/lib/"
207228
208229
echo "Copying header file..."
209230
cp libcrc_fast.h "$PKG_NAME/include/"
210231
211232
echo "Copying CLI binaries..."
212-
cp target/release/checksum "$PKG_NAME/bin/"
213-
cp target/release/arch-check "$PKG_NAME/bin/"
214-
cp target/release/get-custom-params "$PKG_NAME/bin/"
233+
cp target/${{ matrix.target }}/release/checksum "$PKG_NAME/bin/"
234+
cp target/${{ matrix.target }}/release/arch-check "$PKG_NAME/bin/"
235+
cp target/${{ matrix.target }}/release/get-custom-params "$PKG_NAME/bin/"
215236
216237
echo "Setting executable permissions on binaries..."
217238
chmod +x "$PKG_NAME/bin/checksum"
@@ -328,16 +349,16 @@ jobs:
328349
mkdir -p "$PKG_NAME/bin"
329350
330351
echo "Copying library files..."
331-
cp target/release/libcrc_fast.dylib "$PKG_NAME/lib/"
332-
cp target/release/libcrc_fast.a "$PKG_NAME/lib/"
352+
cp target/${{ matrix.target }}/release/libcrc_fast.dylib "$PKG_NAME/lib/"
353+
cp target/${{ matrix.target }}/release/libcrc_fast.a "$PKG_NAME/lib/"
333354
334355
echo "Copying header file..."
335356
cp libcrc_fast.h "$PKG_NAME/include/"
336357
337358
echo "Copying CLI binaries..."
338-
cp target/release/checksum "$PKG_NAME/bin/"
339-
cp target/release/arch-check "$PKG_NAME/bin/"
340-
cp target/release/get-custom-params "$PKG_NAME/bin/"
359+
cp target/${{ matrix.target }}/release/checksum "$PKG_NAME/bin/"
360+
cp target/${{ matrix.target }}/release/arch-check "$PKG_NAME/bin/"
361+
cp target/${{ matrix.target }}/release/get-custom-params "$PKG_NAME/bin/"
341362
342363
echo "Setting executable permissions on binaries..."
343364
chmod +x "$PKG_NAME/bin/checksum"
@@ -453,17 +474,17 @@ jobs:
453474
New-Item -ItemType Directory -Path "$PKG_NAME/include" -Force | Out-Null
454475
455476
Write-Host "Copying library files..."
456-
Copy-Item "target/release/crc_fast.dll" "$PKG_NAME/bin/"
457-
Copy-Item "target/release/crc_fast.dll.lib" "$PKG_NAME/lib/"
458-
Copy-Item "target/release/crc_fast.lib" "$PKG_NAME/lib/"
477+
Copy-Item "target/${{ matrix.target }}/release/crc_fast.dll" "$PKG_NAME/bin/"
478+
Copy-Item "target/${{ matrix.target }}/release/crc_fast.dll.lib" "$PKG_NAME/lib/"
479+
Copy-Item "target/${{ matrix.target }}/release/crc_fast.lib" "$PKG_NAME/lib/"
459480
460481
Write-Host "Copying header file..."
461482
Copy-Item "libcrc_fast.h" "$PKG_NAME/include/"
462483
463484
Write-Host "Copying CLI binaries..."
464-
Copy-Item "target/release/checksum.exe" "$PKG_NAME/bin/"
465-
Copy-Item "target/release/arch-check.exe" "$PKG_NAME/bin/"
466-
Copy-Item "target/release/get-custom-params.exe" "$PKG_NAME/bin/"
485+
Copy-Item "target/${{ matrix.target }}/release/checksum.exe" "$PKG_NAME/bin/"
486+
Copy-Item "target/${{ matrix.target }}/release/arch-check.exe" "$PKG_NAME/bin/"
487+
Copy-Item "target/${{ matrix.target }}/release/get-custom-params.exe" "$PKG_NAME/bin/"
467488
468489
Write-Host "Creating VERSION file..."
469490
"$env:TAG_NAME" | Out-File -FilePath "$PKG_NAME/VERSION" -Encoding utf8 -NoNewline
@@ -641,12 +662,16 @@ jobs:
641662
EXPECTED_FILES=(
642663
"crc-fast-$TAG_NAME-linux-x86_64.tar.gz"
643664
"crc-fast-$TAG_NAME-linux-x86_64.tar.gz.sha256"
665+
"crc-fast-$TAG_NAME-linux-x86.tar.gz"
666+
"crc-fast-$TAG_NAME-linux-x86.tar.gz.sha256"
644667
"crc-fast-$TAG_NAME-linux-aarch64.tar.gz"
645668
"crc-fast-$TAG_NAME-linux-aarch64.tar.gz.sha256"
646669
"crc-fast-$TAG_NAME-macos-aarch64.tar.gz"
647670
"crc-fast-$TAG_NAME-macos-aarch64.tar.gz.sha256"
648671
"crc-fast-$TAG_NAME-windows-x86_64.zip"
649672
"crc-fast-$TAG_NAME-windows-x86_64.zip.sha256"
673+
"crc-fast-$TAG_NAME-windows-x86.zip"
674+
"crc-fast-$TAG_NAME-windows-x86.zip.sha256"
650675
"crc-fast-$TAG_NAME-windows-aarch64.zip"
651676
"crc-fast-$TAG_NAME-windows-aarch64.zip.sha256"
652677
)

.github/workflows/tests.yml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
os: [ubuntu-22.04-arm, ubuntu-24.04-arm, macos-14, macos-15, macos-26, macos-latest, windows-11-arm]
1414
rust-toolchain:
1515
- "1.81" # minimum for this crate
16-
- "1.89" # when AVX-512 VPCLMULQDQ was stabilized
1716
- "stable"
1817
- "nightly"
1918
runs-on: ${{ matrix.os }}
@@ -35,7 +34,7 @@ jobs:
3534
name: Clippy
3635
run: cargo clippy --all-features -- -D warnings
3736
- name: Test
38-
run: cargo test --features cli
37+
run: cargo test --all-features
3938

4039
test-x86_64:
4140
name: Test x86_64
@@ -66,17 +65,16 @@ jobs:
6665
name: Clippy
6766
run: cargo clippy --all-features -- -D warnings
6867
- name: Test
69-
run: cargo test --features cli
68+
run: cargo test --all-features
7069

71-
test-x86:
72-
name: Test x86
70+
test-x86-linux:
71+
name: Test x86 Linux
7372
runs-on: ubuntu-latest
7473
strategy:
7574
matrix:
7675
target: [i586-unknown-linux-gnu, i686-unknown-linux-gnu]
7776
rust-toolchain:
7877
- "1.81" # minimum for this crate
79-
- "1.89" # when AVX-512 VPCLMULQDQ was stabilized
8078
- "stable"
8179
- "nightly"
8280
steps:
@@ -92,7 +90,37 @@ jobs:
9290
- name: Architecture check
9391
run: cross run --features cli --bin arch-check --target ${{ matrix.target }}
9492
- name: Test
95-
run: cross test --features cli --target ${{ matrix.target }}
93+
run: cross test --all-features --target ${{ matrix.target }}
94+
95+
test-x86-windows:
96+
name: Test x86 Windows
97+
runs-on: windows-2022
98+
strategy:
99+
matrix:
100+
rust-toolchain:
101+
- "1.81" # minimum for this crate
102+
- "stable"
103+
- "nightly"
104+
steps:
105+
- uses: actions/checkout@v4 # not pinning to commit hash since this is a GitHub action, which we trust
106+
- uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1.12.0
107+
with:
108+
toolchain: ${{ matrix.rust-toolchain }}
109+
target: i686-pc-windows-msvc
110+
components: rustfmt, clippy
111+
cache-key: windows-x86-${{ matrix.rust-toolchain }}
112+
- name: Check
113+
run: cargo check --all-features --target i686-pc-windows-msvc
114+
- name: Architecture check
115+
run: cargo run --features cli --bin arch-check --target i686-pc-windows-msvc
116+
- if: ${{ matrix.rust-toolchain != 'nightly' }}
117+
name: Format
118+
run: cargo fmt -- --check
119+
- if: ${{ matrix.rust-toolchain != 'nightly' }}
120+
name: Clippy
121+
run: cargo clippy --all-features --target i686-pc-windows-msvc -- -D warnings
122+
- name: Test
123+
run: cargo test --all-features --target i686-pc-windows-msvc
96124

97125
test-software:
98126
name: Test software fallback
@@ -102,7 +130,6 @@ jobs:
102130
target: [powerpc-unknown-linux-gnu, powerpc64-unknown-linux-gnu]
103131
rust-toolchain:
104132
- "1.81" # minimum for this crate
105-
- "1.89" # when AVX-512 VPCLMULQDQ was stabilized
106133
- "stable"
107134
- "nightly"
108135
steps:
@@ -118,7 +145,7 @@ jobs:
118145
- name: Architecture check
119146
run: cross run --features cli --bin arch-check --target ${{ matrix.target }}
120147
- name: Test
121-
run: cross test --features cli --target ${{ matrix.target }}
148+
run: cross test --all-features --target ${{ matrix.target }}
122149

123150
miri-test-x86_64:
124151
name: Miri Test x86_64

0 commit comments

Comments
 (0)