Skip to content

Commit 0eef16f

Browse files
committed
Use matrix setup to test features
1 parent 83b9ac1 commit 0eef16f

File tree

1 file changed

+37
-40
lines changed

1 file changed

+37
-40
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,58 @@ on:
99
name: Continuous integration
1010

1111
jobs:
12-
test-features-none:
13-
name: "Test Suite [Features: None]"
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
- uses: dtolnay/rust-toolchain@stable
18-
- uses: Leafwing-Studios/cargo-cache@v1
19-
- run: cargo build --no-default-features
20-
- run: cargo test --no-default-features
21-
2212
test-features-default:
2313
name: "Test Suite [Features: Default]"
2414
runs-on: ubuntu-latest
2515
steps:
2616
- uses: actions/checkout@v3
2717
- uses: dtolnay/rust-toolchain@stable
28-
- run: cargo build
29-
- run: cargo test
30-
31-
test-features-default-with-serde:
32-
name: "Test Suite [Features: Default + serde]"
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v3
36-
- uses: dtolnay/rust-toolchain@stable
37-
- run: cargo build --features serde
38-
- run: cargo test --features serde
39-
40-
test-features-alloc:
41-
name: "Test Suite [Features: alloc]"
42-
runs-on: ubuntu-latest
43-
steps:
44-
- uses: actions/checkout@v3
45-
- uses: dtolnay/rust-toolchain@stable
46-
- run: cargo build --no-default-features --features alloc,grid
47-
- run: cargo test --no-default-features --features alloc,grid
48-
49-
test-features-alloc-no-grid:
50-
name: "Test Suite [Features: alloc (no grid)]"
18+
- uses: Leafwing-Studios/cargo-cache@v1
19+
- run: |
20+
cargo build
21+
cargo test
22+
23+
# This tests all enabled default features with each of the optional features on top.
24+
test-features-with-default:
5125
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
feature: [serde, random, alloc]
5229
steps:
5330
- uses: actions/checkout@v3
5431
- uses: dtolnay/rust-toolchain@stable
55-
- run: cargo build --no-default-features --features alloc
56-
- run: cargo test --no-default-features --features alloc
57-
58-
test-features-default-no-grid:
59-
name: "Test Suite [Features: std (no grid)]"
32+
- uses: Leafwing-Studios/cargo-cache@v1
33+
- run: |
34+
cargo build --features ${{ matrix.feature }}
35+
cargo test --features ${{ matrix.feature }}
36+
37+
# This test all layout features with each of the optional features in isolation.
38+
test-features-without-default:
6039
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
layout: [flexbox, grid, none]
43+
feature: [std, alloc, serde, none]
6144
steps:
6245
- uses: actions/checkout@v3
6346
- uses: dtolnay/rust-toolchain@stable
6447
- uses: Leafwing-Studios/cargo-cache@v1
65-
- run: cargo build --no-default-features --features std
66-
- run: cargo test --no-default-features --features std
48+
- if: ${{ matrix.layout == 'none' && matrix.feature == 'none' }}
49+
run: |
50+
cargo build --no-default-features
51+
cargo test --no-default-features
52+
- if: ${{ matrix.layout != 'none' && matrix.feature == 'none' }}
53+
run: |
54+
cargo build --no-default-features --features ${{ matrix.layout }}
55+
cargo test --no-default-features --features ${{ matrix.layout }}
56+
- if: ${{ matrix.layout == 'none' && matrix.feature != 'none' }}
57+
run: |
58+
cargo build --no-default-features --features ${{ matrix.feature }}
59+
cargo test --no-default-features --features ${{ matrix.feature }}
60+
- if: ${{ matrix.layout != 'none' && matrix.feature != 'none' }}
61+
run: |
62+
cargo build --no-default-features --features ${{ matrix.layout }},${{ matrix.feature }}
63+
cargo test --no-default-features --features ${{ matrix.layout }},${{ matrix.feature }}
6764
6865
fmt:
6966
name: Rustfmt

0 commit comments

Comments
 (0)