From 29a6a854f13d2d0b4d383d1fc4e920971d933a8e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Sat, 2 Oct 2021 18:33:27 -0500 Subject: [PATCH 1/2] fix(ci): Don't have PRs canceling each others jobs Using `head_ref`, we are making it so PRs are all in the same group. When a new PR comes in (not just an update), it then cancels all other PRs. Switching to `ref` makes it so each PR is in its own concurrency group. --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 4ab09e30e98..c67e630f8a2 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: [master] types: [opened, reopened, synchronize] concurrency: - group: benchmark-${{ github.head_ref }} + group: benchmark-${{ github.ref }} cancel-in-progress: true jobs: benchmark: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8f34ba2435..69b434e7f9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: [master] types: [opened, reopened, synchronize] concurrency: - group: ci-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} + group: ci-${{ github.ref }} cancel-in-progress: true jobs: ci: From 63275d3f1352dfaa69f02e2a66d267c748a38a33 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 1 Oct 2021 14:55:41 -0500 Subject: [PATCH 2/2] Speed up PR feedback This drops us down to just a handlful of jobs, allowing us full parallelism (github caps max parallel jobs). This is dependent on us using bors to run the "ci" before merging into master. 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 - Remove benchmarks because most changes are not performance sensitive and we aren't looking at the results enough to justify a 30 minute run. Fixes #2801 --- .github/workflows/benchmark.yml | 46 ----------------- .github/workflows/ci-pr.yml | 87 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 65 +----------------------- .github/workflows/coverage.yml | 39 +++++++++++++++ .github/workflows/lint.yml | 40 +++++++++++++++ .github/workflows/site.yml | 2 - bors.toml | 2 +- 7 files changed, 168 insertions(+), 113 deletions(-) delete mode 100644 .github/workflows/benchmark.yml create mode 100644 .github/workflows/ci-pr.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index c67e630f8a2..00000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Benchmark -on: - pull_request: - branches: [master] - types: [opened, reopened, synchronize] -concurrency: - group: benchmark-${{ github.ref }} - cancel-in-progress: true -jobs: - benchmark: - name: Benchmark - runs-on: ubuntu-latest - steps: - - name: Install rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Checkout base - uses: actions/checkout@v2 - with: - ref: master - - name: Bench base - run: cargo bench -- --output-format bencher | tee output.txt - - name: Save base benchmark - uses: pksunkara/github-action-benchmark@v1 - with: - tool: cargo - output-file-path: output.txt - external-data-json-path: ./benchmark-data.json - read-commit-id: true - - name: Checkout pull request - uses: actions/checkout@v2 - with: - clean: false - - name: Bench pull request - run: cargo bench -- --output-format bencher | tee output.txt - - name: Compare benchmarks - uses: pksunkara/github-action-benchmark@v2 - with: - tool: cargo - output-file-path: output.txt - external-data-json-path: ./benchmark-data.json - github-token: ${{ github.token }} - annotate-always: true diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 00000000000..21aac0a64ed --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,87 @@ +name: CI-PR +on: + pull_request: + branches: [master] +concurrency: + group: ci-pr-${{ github.ref }} + cancel-in-progress: true +jobs: + ci-pr: + name: CI-PR + needs: [test-minimal, test-full, msrv] + runs-on: ubuntu-latest + steps: + - name: Done + run: exit 0 + test-minimal: + name: Tests (Minimal) + env: + FLAGS: --no-default-features --features 'std cargo' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + rust: [stable] + runs-on: ${{ matrix.os }} + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - name: Cache Builds + uses: Swatinem/rust-cache@v1 + - name: Checkout + uses: actions/checkout@v2 + - name: Compile + run: cargo test --no-run ${{ env.FLAGS }} + - name: Test + run: cargo test ${{ env.FLAGS }} + test-full: + name: Tests (Full) + env: + FLAGS: --features 'wrap_help yaml regex' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + rust: [stable] + runs-on: ${{ matrix.os }} + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - name: Cache Builds + uses: Swatinem/rust-cache@v1 + - name: Checkout + uses: actions/checkout@v2 + - name: Compile + run: cargo test --no-run ${{ env.FLAGS }} + - name: Test + run: cargo test ${{ env.FLAGS }} + msrv: + name: "Check MSRV: 1.54.0" + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.54.0 # MSRV + override: true + - name: Cache Builds + uses: Swatinem/rust-cache@v1 + - name: Checkout + uses: actions/checkout@v2 + - 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 --package clap_derive -- ui diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69b434e7f9e..0aa49ea4ad0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,16 +2,10 @@ name: CI on: push: branches: [master, staging, trying] - pull_request: - branches: [master] - types: [opened, reopened, synchronize] -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true jobs: ci: name: CI - needs: [test, wasm, lint] + needs: [test, wasm] runs-on: ubuntu-latest steps: - name: Done @@ -179,60 +173,3 @@ jobs: 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/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..0de31903c88 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,39 @@ +name: Coverage +on: + pull_request: + branches: [master] + push: + branches: [master, staging, trying] +concurrency: + group: coverage-${{ github.ref }} + cancel-in-progress: true +jobs: + 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/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..3157afcc721 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Lint +on: + pull_request: + branches: [master] + push: + branches: [master, staging, trying] +concurrency: + group: lint-${{ github.ref }} + cancel-in-progress: true +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + - name: Cache Builds + 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" + - 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 diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index bd413c260d9..8861e244678 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -3,8 +3,6 @@ on: push: branches: [master] paths: ["site/**"] -concurrency: - group: site jobs: site: name: Deploy site diff --git a/bors.toml b/bors.toml index 8491ef8c1b2..ccb3d83b8ff 100644 --- a/bors.toml +++ b/bors.toml @@ -2,7 +2,7 @@ status = [ "CI", ] pr_status = [ - "CI", + "CI-PR", "Lint", ] timeout_sec = 7200 prerun_timeout_sec = 7200