Skip to content

Commit dd9086a

Browse files
authored
sha1: add multiplatform tests (#252)
Expands the test suite to be similar to the one used by the `sha2` crate which tests the following platforms: - Linux: i686/x86_64/aarch64 (latter w\ cross) - Windows: x86_64 - macOS: x86_64 Additionally tests the `asm` feature on all Linux platforms as well as on macOS. Tests on i686 and cross-based tests for aarch64 are currently disabled because the `asm` feature is failing. See RustCrypto/hashes#251
1 parent 1c1182c commit dd9086a

File tree

2 files changed

+99
-7
lines changed

2 files changed

+99
-7
lines changed

.github/workflows/sha1.yml

Lines changed: 98 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
RUSTFLAGS: "-Dwarnings"
1818

1919
jobs:
20+
# Builds for no_std platforms
2021
build:
2122
runs-on: ubuntu-latest
2223
strategy:
@@ -37,21 +38,111 @@ jobs:
3738
override: true
3839
- run: cargo build --no-default-features --release --target ${{ matrix.target }}
3940

40-
test:
41+
# Linux tests
42+
linux:
43+
strategy:
44+
matrix:
45+
include:
46+
# 32-bit Linux/x86
47+
# *** NOTE: Currently broken with `asm` feature enabled! See:
48+
# https://github.com/RustCrypto/hashes/issues/251
49+
#- target: i686-unknown-linux-gnu
50+
# rust: 1.41.0 # MSRV
51+
# deps: sudo apt update && sudo apt install gcc-multilib
52+
#- target: i686-unknown-linux-gnu
53+
# rust: stable
54+
# deps: sudo apt update && sudo apt install gcc-multilib
55+
56+
# 64-bit Linux/x86_64
57+
- target: x86_64-unknown-linux-gnu
58+
rust: 1.41.0 # MSRV
59+
- target: x86_64-unknown-linux-gnu
60+
rust: stable
61+
4162
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v1
65+
- uses: actions-rs/toolchain@v1
66+
with:
67+
profile: minimal
68+
toolchain: ${{ matrix.rust }}
69+
target: ${{ matrix.target }}
70+
override: true
71+
- run: ${{ matrix.deps }}
72+
- run: cargo test --target ${{ matrix.target }} --release --no-default-features
73+
- run: cargo test --target ${{ matrix.target }} --release
74+
- run: cargo test --target ${{ matrix.target }} --release --features asm
75+
- run: cargo test --target ${{ matrix.target }} --release --all-features
76+
77+
# macOS tests
78+
macos:
4279
strategy:
4380
matrix:
44-
rust:
81+
toolchain:
4582
- 1.41.0 # MSRV
4683
- stable
84+
85+
runs-on: macos-latest
4786
steps:
4887
- uses: actions/checkout@v1
4988
- uses: actions-rs/toolchain@v1
5089
with:
5190
profile: minimal
52-
toolchain: ${{ matrix.rust }}
91+
toolchain: ${{ matrix.toolchain }}
92+
target: x86_64-apple-darwin
93+
override: true
94+
- run: cargo test --release --no-default-features
95+
- run: cargo test --release
96+
- run: cargo test --release --features asm
97+
- run: cargo test --release --all-features
98+
99+
# Windows tests
100+
windows:
101+
strategy:
102+
matrix:
103+
include:
104+
# 64-bit Windows (GNU)
105+
# TODO(tarcieri): try re-enabling this when we bump MSRV
106+
#- target: x86_64-pc-windows-gnu
107+
# toolchain: 1.41.0 # MSRV
108+
- target: x86_64-pc-windows-gnu
109+
toolchain: stable
110+
111+
runs-on: windows-latest
112+
steps:
113+
- uses: actions/checkout@v1
114+
- uses: actions-rs/toolchain@v1
115+
with:
116+
profile: minimal
117+
toolchain: ${{ matrix.toolchain }}
118+
target: ${{ matrix.target }}
53119
override: true
54-
- run: cargo test --no-default-features
55-
- run: cargo test
56-
- run: cargo test --features asm
57-
- run: cargo test --all-features
120+
- uses: msys2/setup-msys2@v2
121+
- run: cargo test --target ${{ matrix.target }} --release
122+
123+
# Cross-compiled tests
124+
# *** NOTE: Currently broken with `asm` feature enabled! See:
125+
# https://github.com/RustCrypto/hashes/issues/251
126+
#
127+
# cross:
128+
# strategy:
129+
# matrix:
130+
# include:
131+
# # ARM64
132+
# - target: aarch64-unknown-linux-gnu
133+
# rust: 1.41.0 # MSRV
134+
# - target: aarch64-unknown-linux-gnu
135+
# rust: stable
136+
#
137+
# runs-on: ubuntu-latest
138+
# steps:
139+
# - uses: actions/checkout@v1
140+
# - uses: actions-rs/toolchain@v1
141+
# with:
142+
# profile: minimal
143+
# toolchain: ${{ matrix.rust }}
144+
# target: ${{ matrix.target }}
145+
# override: true
146+
# - run: cargo install cross
147+
# - run: cross test --target ${{ matrix.target }} --release
148+
# - run: cross test --target ${{ matrix.target }} --release --features asm

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)