Skip to content

Commit

Permalink
ci: reduce the number of CI jobs (#28)
Browse files Browse the repository at this point in the history
With 3 operating systems, 3 rust versions, and 2 set of arguments for cargo-test, the combinations in the test matrix grew to 18 (3x3x2) jobs. This reduces the number of jobs while introduces tests in more platforms.
  • Loading branch information
plusvic authored May 18, 2023
1 parent afc2bdb commit c5238f1
Showing 1 changed file with 71 additions and 36 deletions.
107 changes: 71 additions & 36 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,80 @@
name: Test suite

on: [push, pull_request]

name: Tests
on:
pull_request:
push:
jobs:
tests:
name: Run tests
test:
name: test
env:
CARGO_TERM_COLOR: always
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
rust:
- stable
- nightly
- 1.66.1 # Minimum Supported Rust Version (MSRV)
cargo-test-args:
- "--features=test_proto2-module,test_proto3-module,ascii-tree"
- "--features=constant-folding,test_proto2-module,test_proto3-module,ascii-tree"
env:
CARGO_TERM_COLOR: always
build:
- msrv
- stable
- nightly
- macos
- win-msvc
- win-gnu
- constant-folding-off
include:
- build: msrv
os: ubuntu-latest
rust: 1.66.1
args: ""

- build: stable
os: ubuntu-latest
rust: stable
args: ""

- build: nightly
os: ubuntu-latest
rust: nightly
args: ""

- build: macos
os: macos-latest
rust: stable
args: ""

- build: win-msvc
os: windows-latest
rust: stable
args: ""

- build: win-gnu
os: windows-latest
rust: stable-x86_64-gnu
args: ""

- build: constant-folding-off
os: ubuntu-latest
rust: stable
args: "--no-default-features --features=test_proto2-module,test_proto3-module,ascii-tree"
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Checkout sources
uses: actions/checkout@v3

- name: Setup cache
uses: actions/cache@v3
with:
path: |
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets --no-default-features ${{ matrix.cargo-test-args }}
env:
RUSTFLAGS: -Awarnings # Allow all warnings
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets ${{ matrix.args }}
env:
RUSTFLAGS: -Awarnings # Allow all warnings

0 comments on commit c5238f1

Please sign in to comment.