From c5238f14a6ef550849f1173a3328ea898beb6766 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Thu, 18 May 2023 11:41:28 +0200 Subject: [PATCH] ci: reduce the number of CI jobs (#28) 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. --- .github/workflows/tests.yaml | 107 +++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 36 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 34dd037b4..c31236fc6 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 \ No newline at end of file + 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