Skip to content

Commit 51fca5a

Browse files
authored
Run tests using cargo hack (#364)
This dynamically ensures that the various combinations of features flags successfully work. Signed-off-by: Nathaniel McCallum <[email protected]>
1 parent bd1b796 commit 51fca5a

File tree

32 files changed

+91
-160
lines changed

32 files changed

+91
-160
lines changed

.github/workflows/base16ct.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
toolchain: ${{ matrix.rust }}
3636
target: ${{ matrix.target }}
3737
override: true
38-
- run: cargo build --target ${{ matrix.target }} --release
39-
- run: cargo build --target ${{ matrix.target }} --release --features alloc
38+
- run: cargo install cargo-hack
39+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4040

4141
test:
4242
runs-on: ubuntu-latest
@@ -52,9 +52,8 @@ jobs:
5252
profile: minimal
5353
toolchain: ${{ matrix.rust }}
5454
override: true
55-
- run: cargo test --release
56-
- run: cargo test --release --features alloc
57-
- run: cargo test --release --all-features
55+
- run: cargo install cargo-hack
56+
- run: cargo hack test --release --feature-powerset
5857

5958
bench:
6059
runs-on: ubuntu-latest

.github/workflows/base64ct.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
toolchain: ${{ matrix.rust }}
3636
target: ${{ matrix.target }}
3737
override: true
38-
- run: cargo build --target ${{ matrix.target }} --release
39-
- run: cargo build --target ${{ matrix.target }} --release --features alloc
38+
- run: cargo install cargo-hack
39+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4040

4141
test:
4242
runs-on: ubuntu-latest
@@ -52,9 +52,8 @@ jobs:
5252
profile: minimal
5353
toolchain: ${{ matrix.rust }}
5454
override: true
55-
- run: cargo test --release
56-
- run: cargo test --release --features alloc
57-
- run: cargo test --release --all-features
55+
- run: cargo install cargo-hack
56+
- run: cargo hack test --release --feature-powerset
5857

5958
bench:
6059
runs-on: ubuntu-latest

.github/workflows/const-oid.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
toolchain: ${{ matrix.rust }}
3636
target: ${{ matrix.target }}
3737
override: true
38-
- run: cargo build --target ${{ matrix.target }} --release
38+
- run: cargo install cargo-hack
39+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
3940

4041
test:
4142
runs-on: ubuntu-latest
@@ -51,5 +52,5 @@ jobs:
5152
profile: minimal
5253
toolchain: ${{ matrix.rust }}
5354
override: true
54-
- run: cargo test --release
55-
- run: cargo test --release --all-features
55+
- run: cargo install cargo-hack
56+
- run: cargo hack test --release --feature-powerset

.github/workflows/der.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@ jobs:
3636
toolchain: ${{ matrix.rust }}
3737
target: ${{ matrix.target }}
3838
override: true
39-
- run: cargo build --target ${{ matrix.target }} --release
40-
- run: cargo build --target ${{ matrix.target }} --release --features alloc
41-
- run: cargo build --target ${{ matrix.target }} --release --features derive
42-
- run: cargo build --target ${{ matrix.target }} --release --features oid
43-
- run: cargo build --target ${{ matrix.target }} --release --features pem
44-
- run: cargo build --target ${{ matrix.target }} --release --features time
45-
- run: cargo build --target ${{ matrix.target }} --release --features alloc,derive,oid,pem,time
39+
- run: cargo install cargo-hack
40+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4641

4742
test:
4843
strategy:
@@ -83,10 +78,8 @@ jobs:
8378
profile: minimal
8479
override: true
8580
- run: ${{ matrix.deps }}
86-
- run: cargo test --target ${{ matrix.target }} --release
87-
- run: cargo test --target ${{ matrix.target }} --release --features oid
88-
- run: cargo test --target ${{ matrix.target }} --release --features pem
89-
- run: cargo test --target ${{ matrix.target }} --release --all-features
81+
- run: cargo install cargo-hack
82+
- run: cargo hack test --release --feature-powerset
9083

9184
derive:
9285
runs-on: ubuntu-latest
@@ -102,5 +95,6 @@ jobs:
10295
toolchain: ${{ matrix.rust }}
10396
override: true
10497
profile: minimal
105-
- run: cargo test --release
98+
- run: cargo install cargo-hack
99+
- run: cargo hack test --release --feature-powerset
106100
working-directory: der/derive

.github/workflows/pem-rfc7468.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
toolchain: ${{ matrix.rust }}
3737
target: ${{ matrix.target }}
3838
override: true
39-
- run: cargo build --target ${{ matrix.target }} --release
40-
- run: cargo build --target ${{ matrix.target }} --release --features alloc
39+
- run: cargo install cargo-hack
40+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4141

4242
test:
4343
runs-on: ubuntu-latest
@@ -53,6 +53,5 @@ jobs:
5353
profile: minimal
5454
toolchain: ${{ matrix.rust }}
5555
override: true
56-
- run: cargo test --release --no-default-features
57-
- run: cargo test --release
58-
- run: cargo test --release --all-features
56+
- run: cargo install cargo-hack
57+
- run: cargo hack test --release --feature-powerset

.github/workflows/pkcs1.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ jobs:
3939
toolchain: ${{ matrix.rust }}
4040
target: ${{ matrix.target }}
4141
override: true
42-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features
43-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc
44-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pem
45-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pkcs8
46-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features zeroize
47-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,pem,pkcs8,zeroize
42+
- run: cargo install cargo-hack
43+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4844

4945
test:
5046
runs-on: ubuntu-latest
@@ -60,6 +56,5 @@ jobs:
6056
profile: minimal
6157
toolchain: ${{ matrix.rust }}
6258
override: true
63-
- run: cargo test --release --no-default-features
64-
- run: cargo test --release
65-
- run: cargo test --release --all-features
59+
- run: cargo install cargo-hack
60+
- run: cargo hack test --release --feature-powerset

.github/workflows/pkcs5.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,8 @@ jobs:
3838
toolchain: ${{ matrix.rust }}
3939
target: ${{ matrix.target }}
4040
override: true
41-
- run: cargo build --target ${{ matrix.target }} --release
42-
- run: cargo build --target ${{ matrix.target }} --release --features alloc
43-
- run: cargo build --target ${{ matrix.target }} --release --features pbes2
44-
- run: cargo build --target ${{ matrix.target }} --release --features scrypt
45-
- run: cargo build --target ${{ matrix.target }} --release --features alloc,pbes2
46-
- run: cargo build --target ${{ matrix.target }} --release --features sha1
47-
- run: cargo build --target ${{ matrix.target }} --release --features 3des
48-
- run: cargo build --target ${{ matrix.target }} --release --features des-insecure
41+
- run: cargo install cargo-hack
42+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
4943

5044
test:
5145
runs-on: ubuntu-latest
@@ -61,11 +55,5 @@ jobs:
6155
profile: minimal
6256
toolchain: ${{ matrix.rust }}
6357
override: true
64-
- run: cargo test --release
65-
- run: cargo test --release --features alloc
66-
- run: cargo test --release --features pbes2
67-
- run: cargo test --release --features scrypt
68-
- run: cargo test --release --features sha1
69-
- run: cargo test --release --features 3des
70-
- run: cargo test --release --features des-insecure
71-
- run: cargo test --release --all-features
58+
- run: cargo install cargo-hack
59+
- run: cargo hack test --release --feature-powerset

.github/workflows/pkcs7.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ jobs:
3737
toolchain: ${{ matrix.rust }}
3838
target: ${{ matrix.target }}
3939
override: true
40-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features
40+
- run: cargo install cargo-hack
41+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset
4142

4243
test:
4344
runs-on: ubuntu-latest
@@ -53,6 +54,5 @@ jobs:
5354
profile: minimal
5455
toolchain: ${{ matrix.rust }}
5556
override: true
56-
- run: cargo test --release --no-default-features
57-
- run: cargo test --release
58-
- run: cargo test --release --all-features
57+
- run: cargo install cargo-hack
58+
- run: cargo hack test --release --feature-powerset

.github/workflows/pkcs8.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,8 @@ jobs:
4040
toolchain: ${{ matrix.rust }}
4141
target: ${{ matrix.target }}
4242
override: true
43-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features
44-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features alloc
45-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features 3des
46-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features des-insecure
47-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features encryption
48-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features pem
49-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features pkcs5
50-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features sha1
51-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features subtle
52-
- run: cargo build --release --target ${{ matrix.target }} --no-default-features --features zeroize
43+
- run: cargo install cargo-hack
44+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std,rand
5345

5446
test:
5547
runs-on: ubuntu-latest
@@ -65,14 +57,5 @@ jobs:
6557
profile: minimal
6658
toolchain: ${{ matrix.rust }}
6759
override: true
68-
- run: cargo test --release --no-default-features
69-
- run: cargo test --release
70-
- run: cargo test --release --features alloc
71-
- run: cargo test --release --features 3des
72-
- run: cargo test --release --features des-insecure
73-
- run: cargo test --release --features encryption
74-
- run: cargo test --release --features pem
75-
- run: cargo test --release --features pkcs5
76-
- run: cargo test --release --features sha1
77-
- run: cargo test --release --features std
78-
- run: cargo test --release --all-features
60+
- run: cargo install cargo-hack
61+
- run: cargo hack test --release --feature-powerset

.github/workflows/sec1.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ jobs:
3939
toolchain: ${{ matrix.rust }}
4040
target: ${{ matrix.target }}
4141
override: true
42-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features
43-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc
44-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pem
45-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features pkcs8
46-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features serde
47-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features subtle
48-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features zeroize
49-
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,pem,pkcs8,serde,subtle,zeroize
42+
- run: cargo install cargo-hack
43+
- run: cargo hack build --release --target ${{ matrix.target }} --feature-powerset --exclude-features std
5044

5145
test:
5246
runs-on: ubuntu-latest
@@ -62,6 +56,5 @@ jobs:
6256
profile: minimal
6357
toolchain: ${{ matrix.rust }}
6458
override: true
65-
- run: cargo test --release --no-default-features
66-
- run: cargo test --release
67-
- run: cargo test --release --all-features
59+
- run: cargo install cargo-hack
60+
- run: cargo hack test --release --feature-powerset

0 commit comments

Comments
 (0)