Skip to content

Commit

Permalink
Use matrix setup to test features
Browse files Browse the repository at this point in the history
  • Loading branch information
Weibye committed Apr 10, 2023
1 parent c3b8fc5 commit 35f1ad8
Showing 1 changed file with 40 additions and 66 deletions.
106 changes: 40 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,92 +9,66 @@ on:
name: Continuous integration

jobs:
# None
test-features-none:
name: "Test Suite [Features: None]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo build --no-default-features
- run: cargo test --no-default-features

# Default
test-features-default:
name: "Test Suite [Features: Default]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build
- run: cargo test

test-features-default-with-serde:
name: "Test Suite [Features: Default + serde]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --features serde
- run: cargo test --features serde

test-features-no-grid-nor-flexbox:
name: "Test Suite [Features: std (no grid or flexbox)]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features std
- run: cargo test --no-default-features --features std

# Flexbox
test-features-flexbox:
name: "Test Suite [Features: flexbox + std]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features flexbox,std
- run: cargo test --no-default-features --features flexbox,std

# Grid
test-features-grid:
name: "Test Suite [Features: grid + std]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features grid,std
- run: cargo test --no-default-features --features grid,std
- uses: Leafwing-Studios/cargo-cache@v1
- run: |
cargo build
cargo test
test-features-grid-with-alloc:
name: "Test Suite [Features: grid + alloc]"
test-features-no-default:
name: "Test Suite [Features: None]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features alloc,grid
- run: cargo test --no-default-features --features alloc,grid

test-features-alloc:
name: "Test Suite [Features: alloc]"
- uses: Leafwing-Studios/cargo-cache@v1
- run: |
cargo build --no-default-features
cargo test --no-default-features
# This tests all enabled default features with each of the optional features on top.
test-features-with-default:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [serde, random]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features alloc
- run: cargo test --no-default-features --features alloc

test-features-default-no-grid:
name: "Test Suite [Features: std (no grid)]"
- uses: Leafwing-Studios/cargo-cache@v1
- run: |
cargo build --features ${{ matrix.feature }}
cargo test --features ${{ matrix.feature }}
# This test all layout features with each of the optional features in isolation.
test-features-without-default:
runs-on: ubuntu-latest
strategy:
matrix:
layout: [flexbox, grid, none]
allocation: [std, alloc]
feature: [serde, random, none]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo build --no-default-features --features std
- run: cargo test --no-default-features --features std
- if: ${{ matrix.layout != 'none' && matrix.feature == 'none' }}
run: |
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }}
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }}
- if: ${{ matrix.layout == 'none' && matrix.feature != 'none' }}
run: |
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.feature }}
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.feature }}
- if: ${{ matrix.layout != 'none' && matrix.feature != 'none' }}
run: |
cargo build --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }},${{ matrix.feature }}
cargo test --no-default-features --features ${{ matrix.allocation }},${{ matrix.layout }},${{ matrix.feature }}
fmt:
name: Rustfmt
Expand Down

0 comments on commit 35f1ad8

Please sign in to comment.