From 24a2d245d580d08cf5a2aea674e46007844b2870 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 1 Oct 2021 14:55:41 -0500 Subject: [PATCH] WIP: Speed up PR feedback This drops us down to just a handlful of jobs, allowing us to full parallelism (github caps max parallel jobs). There is a balance in what to run. We should consider what is most likely to break for the widest variety of PRs. Contributors that expect an uncovered case to fail can always specify `@bors try` Motivation - Mac is similar enough to Linux, we only need to run one of them and Linux has more parallel runners on Github. - Since we deal with `OsStr`, test Windows because its different than the others. - People are most likely to make changes on `stable` and break support for MSRV, so we should verify that - Still test on `stable` to not block feedback if we run into problems with dependencies and our MSRV run. - On the other hand, beta and nightly are less likely to break on an individual PR. This is depednent on us using bors to run the ci-full before merging into master. Fixes #2801 --- .github/workflows/ci-full.yml | 235 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 173 ++++--------------------- 2 files changed, 262 insertions(+), 146 deletions(-) create mode 100644 .github/workflows/ci-full.yml diff --git a/.github/workflows/ci-full.yml b/.github/workflows/ci-full.yml new file mode 100644 index 000000000000..0985ce83de18 --- /dev/null +++ b/.github/workflows/ci-full.yml @@ -0,0 +1,235 @@ +name: CI Full +on: + push: + branches: [master, staging, trying] +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true +jobs: + ci-full: + name: CI Full + needs: [test, wasm, lint] + runs-on: ubuntu-latest + steps: + - name: Done + run: exit 0 + test: + name: Tests + strategy: + fail-fast: false + matrix: + rust: [1.54.0, stable, beta] + os: [windows-latest, macos-latest, ubuntu-latest] + target: + - i686-pc-windows-msvc + - x86_64-pc-windows-msvc + - i686-pc-windows-gnu + - x86_64-pc-windows-gnu + - x86_64-unknown-linux-gnu + - i686-unknown-linux-gnu + - x86_64-apple-darwin + features: + - none + - all + - release + exclude: + - features: release + rust: stable + - features: release + rust: beta + - os: windows-latest + target: x86_64-apple-darwin + - os: windows-latest + target: x86_64-unknown-linux-gnu + - os: windows-latest + target: i686-unknown-linux-gnu + - os: macos-latest + target: i686-pc-windows-msvc + - os: macos-latest + target: x86_64-pc-windows-msvc + - os: macos-latest + target: i686-pc-windows-gnu + - os: macos-latest + target: x86_64-pc-windows-gnu + - os: macos-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: i686-unknown-linux-gnu + - os: ubuntu-latest + target: i686-pc-windows-msvc + - os: ubuntu-latest + target: x86_64-pc-windows-msvc + - os: ubuntu-latest + target: i686-pc-windows-gnu + - os: ubuntu-latest + target: x86_64-pc-windows-gnu + - os: ubuntu-latest + target: x86_64-apple-darwin + runs-on: ${{ matrix.os }} + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Install linker + if: matrix.target == 'i686-pc-windows-gnu' + uses: egor-tensin/setup-mingw@v2 + with: + platform: x86 + - name: Install linker + if: matrix.target == 'x86_64-pc-windows-gnu' + uses: egor-tensin/setup-mingw@v2 + - name: Install linker + if: matrix.target == 'i686-unknown-linux-gnu' + run: | + sudo apt-get update + sudo apt-get install gcc-multilib + - name: Test almost no features + uses: actions-rs/cargo@v1 + if: matrix.features == 'none' + with: + command: test + args: --target ${{ matrix.target }} --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 + - name: Test all features + uses: actions-rs/cargo@v1 + if: matrix.features == 'all' + with: + command: test + args: --target ${{ matrix.target }} --features "wrap_help yaml regex" + - name: Check debug + uses: actions-rs/cargo@v1 + if: matrix.features == 'all' + with: + command: check + args: --target ${{ matrix.target }} --features "wrap_help yaml regex debug" + - name: Test release + uses: actions-rs/cargo@v1 + if: matrix.features == 'release' + with: + command: test + args: --target ${{ matrix.target }} --features "wrap_help yaml regex" --release + nightly: + name: Nightly Tests + strategy: + fail-fast: false + matrix: + features: + - none + - all + - release + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Test almost no features + uses: actions-rs/cargo@v1 + if: matrix.features == 'none' + with: + command: test + args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 + - name: Test all features + uses: actions-rs/cargo@v1 + if: matrix.features == 'all' + with: + command: test + args: --features "wrap_help yaml regex" + - name: Check debug + uses: actions-rs/cargo@v1 + if: matrix.features == 'all' + with: + command: check + args: --features "wrap_help yaml regex debug" + - name: Test release + uses: actions-rs/cargo@v1 + if: matrix.features == 'release' + with: + command: test + args: --features "wrap_help yaml regex" --release + wasm: + name: Wasm Check + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [wasm32-unknown-unknown, wasm32-wasi] + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.54.0 + target: ${{ matrix.target }} + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Check + uses: actions-rs/cargo@v1 + with: + command: check + args: --target ${{ matrix.target }} --features "yaml regex" + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + - name: Checkout + uses: actions/checkout@v2 + - name: Clippy for almost no features + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 + - name: Clippy for all features + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --features "wrap_help yaml regex" -- -D warnings + - name: Format check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + coverage: + name: Coverage + continue-on-error: true + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: llvm-tools-preview + override: true + - name: Checkout + uses: actions/checkout@v2 + - name: Install llvm-cov + uses: actions-rs/install@v0.1 + with: + crate: cargo-llvm-cov + version: 0.1.0-alpha.4 + use-tool-cache: true + - name: Coverage + uses: actions-rs/cargo@v1 + with: + command: llvm-cov + args: --features "wrap_help yaml regex" --lcov --output-path lcov.info + - name: Coveralls + uses: coverallsapp/github-action@master + with: + path-to-lcov: lcov.info + github-token: ${{ secrets.github_token }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8f34ba24355..5a3576f326db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,14 @@ name: CI on: - push: - branches: [master, staging, trying] pull_request: branches: [master] - types: [opened, reopened, synchronize] concurrency: - group: ci-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} + group: ci-${{ github.head_ref }} cancel-in-progress: true jobs: ci: name: CI - needs: [test, wasm, lint] + needs: [test, msrv, lint] runs-on: ubuntu-latest steps: - name: Done @@ -21,53 +18,8 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.54.0, stable, beta] - os: [windows-latest, macos-latest, ubuntu-latest] - target: - - i686-pc-windows-msvc - - x86_64-pc-windows-msvc - - i686-pc-windows-gnu - - x86_64-pc-windows-gnu - - x86_64-unknown-linux-gnu - - i686-unknown-linux-gnu - - x86_64-apple-darwin - features: - - none - - all - - release - exclude: - - features: release - rust: stable - - features: release - rust: beta - - os: windows-latest - target: x86_64-apple-darwin - - os: windows-latest - target: x86_64-unknown-linux-gnu - - os: windows-latest - target: i686-unknown-linux-gnu - - os: macos-latest - target: i686-pc-windows-msvc - - os: macos-latest - target: x86_64-pc-windows-msvc - - os: macos-latest - target: i686-pc-windows-gnu - - os: macos-latest - target: x86_64-pc-windows-gnu - - os: macos-latest - target: x86_64-unknown-linux-gnu - - os: macos-latest - target: i686-unknown-linux-gnu - - os: ubuntu-latest - target: i686-pc-windows-msvc - - os: ubuntu-latest - target: x86_64-pc-windows-msvc - - os: ubuntu-latest - target: i686-pc-windows-gnu - - os: ubuntu-latest - target: x86_64-pc-windows-gnu - - os: ubuntu-latest - target: x86_64-apple-darwin + os: ["ubuntu-latest", "windows-latest"] + rust: ["stable"] runs-on: ${{ matrix.os }} steps: - name: Install rust @@ -75,110 +27,37 @@ jobs: with: profile: minimal toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} override: true + - uses: Swatinem/rust-cache@v1 - name: Checkout uses: actions/checkout@v2 - - name: Install linker - if: matrix.target == 'i686-pc-windows-gnu' - uses: egor-tensin/setup-mingw@v2 - with: - platform: x86 - - name: Install linker - if: matrix.target == 'x86_64-pc-windows-gnu' - uses: egor-tensin/setup-mingw@v2 - - name: Install linker - if: matrix.target == 'i686-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install gcc-multilib - - name: Test almost no features - uses: actions-rs/cargo@v1 - if: matrix.features == 'none' - with: - command: test - args: --target ${{ matrix.target }} --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 - - name: Test all features - uses: actions-rs/cargo@v1 - if: matrix.features == 'all' - with: - command: test - args: --target ${{ matrix.target }} --features "wrap_help yaml regex" - - name: Check debug - uses: actions-rs/cargo@v1 - if: matrix.features == 'all' - with: - command: check - args: --target ${{ matrix.target }} --features "wrap_help yaml regex debug" - - name: Test release - uses: actions-rs/cargo@v1 - if: matrix.features == 'release' - with: - command: test - args: --target ${{ matrix.target }} --features "wrap_help yaml regex" --release - nightly: - name: Nightly Tests - strategy: - fail-fast: false - matrix: - features: - - none - - all - - release + - name: Default features + run: cargo test --all-targets + - name: All features + Debug + run: cargo test --all-targets --features "wrap_help yaml regex debug" + - name: No features + run: cargo test --all-targets --no-default-features --features "std cargo" + msrv: + name: "Check MSRV: 1.54.0" runs-on: ubuntu-latest steps: - name: Install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly - override: true - - name: Checkout - uses: actions/checkout@v2 - - name: Test almost no features - uses: actions-rs/cargo@v1 - if: matrix.features == 'none' - with: - command: test - args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 - - name: Test all features - uses: actions-rs/cargo@v1 - if: matrix.features == 'all' - with: - command: test - args: --features "wrap_help yaml regex" - - name: Check debug - uses: actions-rs/cargo@v1 - if: matrix.features == 'all' - with: - command: check - args: --features "wrap_help yaml regex debug" - - name: Test release - uses: actions-rs/cargo@v1 - if: matrix.features == 'release' - with: - command: test - args: --features "wrap_help yaml regex" --release - wasm: - name: Wasm Check - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - target: [wasm32-unknown-unknown, wasm32-wasi] - steps: - - name: Install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.54.0 - target: ${{ matrix.target }} + profile: minimal + toolchain: 1.54.0 # MSRV override: true + - uses: Swatinem/rust-cache@v1 - name: Checkout uses: actions/checkout@v2 - - name: Check - uses: actions-rs/cargo@v1 - with: - command: check - args: --target ${{ matrix.target }} --features "yaml regex" + - name: Default features + run: cargo check --all-targets + - name: All features + Debug + run: cargo check --all-targets --features "wrap_help yaml regex debug" + - name: No features + run: cargo check --all-targets --no-default-features --features "std cargo" + - name: UI Tests + run: cargo --test clap_derive -- ui lint: name: Linting runs-on: ubuntu-latest @@ -190,13 +69,14 @@ jobs: toolchain: stable override: true components: rustfmt, clippy + - uses: Swatinem/rust-cache@v1 - name: Checkout uses: actions/checkout@v2 - name: Clippy for almost no features uses: actions-rs/cargo@v1 with: command: clippy - args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.4 + args: --no-default-features --features "std cargo" - name: Clippy for all features uses: actions-rs/cargo@v1 with: @@ -218,6 +98,7 @@ jobs: toolchain: nightly components: llvm-tools-preview override: true + - uses: Swatinem/rust-cache@v1 - name: Checkout uses: actions/checkout@v2 - name: Install llvm-cov