Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use matrix setup in our workflow to test features #420

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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