Skip to content

Commit 35f1ad8

Browse files
committed
Use matrix setup to test features
1 parent c3b8fc5 commit 35f1ad8

File tree

1 file changed

+40
-66
lines changed

1 file changed

+40
-66
lines changed

.github/workflows/ci.yml

+40-66
Original file line numberDiff line numberDiff line change
@@ -9,92 +9,66 @@ on:
99
name: Continuous integration
1010

1111
jobs:
12-
# None
13-
test-features-none:
14-
name: "Test Suite [Features: None]"
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v3
18-
- uses: dtolnay/rust-toolchain@stable
19-
- uses: Leafwing-Studios/cargo-cache@v1
20-
- run: cargo build --no-default-features
21-
- run: cargo test --no-default-features
22-
23-
# Default
2412
test-features-default:
2513
name: "Test Suite [Features: Default]"
2614
runs-on: ubuntu-latest
2715
steps:
2816
- uses: actions/checkout@v3
2917
- uses: dtolnay/rust-toolchain@stable
30-
- run: cargo build
31-
- run: cargo test
32-
33-
test-features-default-with-serde:
34-
name: "Test Suite [Features: Default + serde]"
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v3
38-
- uses: dtolnay/rust-toolchain@stable
39-
- run: cargo build --features serde
40-
- run: cargo test --features serde
41-
42-
test-features-no-grid-nor-flexbox:
43-
name: "Test Suite [Features: std (no grid or flexbox)]"
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@v3
47-
- uses: dtolnay/rust-toolchain@stable
48-
- run: cargo build --no-default-features --features std
49-
- run: cargo test --no-default-features --features std
50-
51-
# Flexbox
52-
test-features-flexbox:
53-
name: "Test Suite [Features: flexbox + std]"
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v3
57-
- uses: dtolnay/rust-toolchain@stable
58-
- run: cargo build --no-default-features --features flexbox,std
59-
- run: cargo test --no-default-features --features flexbox,std
60-
61-
# Grid
62-
test-features-grid:
63-
name: "Test Suite [Features: grid + std]"
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v3
67-
- uses: dtolnay/rust-toolchain@stable
68-
- run: cargo build --no-default-features --features grid,std
69-
- run: cargo test --no-default-features --features grid,std
18+
- uses: Leafwing-Studios/cargo-cache@v1
19+
- run: |
20+
cargo build
21+
cargo test
7022
71-
test-features-grid-with-alloc:
72-
name: "Test Suite [Features: grid + alloc]"
23+
test-features-no-default:
24+
name: "Test Suite [Features: None]"
7325
runs-on: ubuntu-latest
7426
steps:
7527
- uses: actions/checkout@v3
7628
- uses: dtolnay/rust-toolchain@stable
77-
- run: cargo build --no-default-features --features alloc,grid
78-
- run: cargo test --no-default-features --features alloc,grid
79-
80-
test-features-alloc:
81-
name: "Test Suite [Features: alloc]"
29+
- uses: Leafwing-Studios/cargo-cache@v1
30+
- run: |
31+
cargo build --no-default-features
32+
cargo test --no-default-features
33+
34+
# This tests all enabled default features with each of the optional features on top.
35+
test-features-with-default:
8236
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
feature: [serde, random]
8340
steps:
8441
- uses: actions/checkout@v3
8542
- uses: dtolnay/rust-toolchain@stable
86-
- run: cargo build --no-default-features --features alloc
87-
- run: cargo test --no-default-features --features alloc
88-
89-
test-features-default-no-grid:
90-
name: "Test Suite [Features: std (no grid)]"
43+
- uses: Leafwing-Studios/cargo-cache@v1
44+
- run: |
45+
cargo build --features ${{ matrix.feature }}
46+
cargo test --features ${{ matrix.feature }}
47+
48+
# This test all layout features with each of the optional features in isolation.
49+
test-features-without-default:
9150
runs-on: ubuntu-latest
51+
strategy:
52+
matrix:
53+
layout: [flexbox, grid, none]
54+
allocation: [std, alloc]
55+
feature: [serde, random, none]
9256
steps:
9357
- uses: actions/checkout@v3
9458
- uses: dtolnay/rust-toolchain@stable
9559
- uses: Leafwing-Studios/cargo-cache@v1
96-
- run: cargo build --no-default-features --features std
97-
- run: cargo test --no-default-features --features std
60+
- if: ${{ matrix.layout != 'none' && matrix.feature == 'none' }}
61+
run: |
62+
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }}
63+
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }}
64+
- if: ${{ matrix.layout == 'none' && matrix.feature != 'none' }}
65+
run: |
66+
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.feature }}
67+
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.feature }}
68+
- if: ${{ matrix.layout != 'none' && matrix.feature != 'none' }}
69+
run: |
70+
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }},${{ matrix.feature }}
71+
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }},${{ matrix.feature }}
9872
9973
fmt:
10074
name: Rustfmt

0 commit comments

Comments
 (0)