chore(ci): Reduce scope

This commit is contained in:
Ed Page 2021-11-17 13:55:28 -06:00
parent 2113b044e7
commit b06f69b08d
7 changed files with 283 additions and 320 deletions

View file

@ -1,87 +0,0 @@
name: CI-PR
on:
pull_request:
branches: [main]
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 unstable-replace unstable-multicall unstable-grouped'
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 unstable-replace unstable-multicall unstable-grouped 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

View file

@ -1,175 +1,181 @@
name: CI name: CI
on: on:
pull_request:
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
push: push:
branches: [main] branches:
- master
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
schedule:
- cron: '3 3 3 * *'
jobs: jobs:
ci: ci:
name: CI name: CI
needs: [test, wasm] needs: [smoke, test, check, docs, rustfmt, clippy]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Done - name: Done
run: exit 0 run: exit 0
smoke:
name: Quick Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Default features
run: make check-default
test: test:
name: Tests name: Test
needs: smoke
strategy:
matrix:
build: [linux, windows, mac, minimal, default]
include:
- build: linux
os: ubuntu-latest
rust: "stable"
features: "full"
- build: windows
os: windows-latest
rust: "stable"
features: "full"
- build: mac
os: macos-latest
rust: "stable"
features: "full"
- build: minimal
os: ubuntu-latest
rust: "stable"
features: "minimal"
- build: default
os: ubuntu-latest
rust: "stable"
features: "default"
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: make build-${{matrix.features}}
- name: Test
run: make test-${{matrix.features}}
check:
name: Check
needs: smoke
runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
rust: [1.54.0, stable, beta] build: [msrv, wasm, wasm-wasi, debug, release]
os: [windows-latest, macos-latest, ubuntu-latest] include:
target: - build: msrv
- i686-pc-windows-msvc rust: 1.54.0 # MSRV
- x86_64-pc-windows-msvc target: x86_64-unknown-linux-gnu
- i686-pc-windows-gnu features: full
- x86_64-pc-windows-gnu - build: wasm
- x86_64-unknown-linux-gnu rust: stable
- i686-unknown-linux-gnu target: wasm32-unknown-unknown
- x86_64-apple-darwin features: wasm
features: - build: wasm-wasi
- none rust: stable
- all target: wasm32-wasi
- release features: wasm
exclude: - build: debug
- features: release
rust: stable rust: stable
- features: release
rust: beta
- os: windows-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
- os: windows-latest features: debug
target: i686-unknown-linux-gnu - build: release
- os: macos-latest rust: stable
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 target: x86_64-unknown-linux-gnu
- os: macos-latest features: release
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: steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install rust - name: Install rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }} target: ${{ matrix.target }}
override: true override: true
- name: Checkout - uses: Swatinem/rust-cache@v1
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.5
- 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 unstable-replace unstable-multicall unstable-grouped"
- name: Check debug
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: check
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped 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 unstable-replace unstable-multicall unstable-grouped" --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.5
- name: Test all features
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: test
args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped"
- name: Check debug
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: check
args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped debug"
- name: Test release
uses: actions-rs/cargo@v1
if: matrix.features == 'release'
with:
command: test
args: --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped" --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 - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Check - name: Check
uses: actions-rs/cargo@v1 run: make check-${{ matrix.features }}
with: docs:
command: check name: Docs
args: --target ${{ matrix.target }} --features "yaml regex unstable-replace unstable-multicall unstable-grouped" needs: smoke
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --all-features --no-deps --document-private-items
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
# Not MSRV because its harder to jump between versions and people are
# more likely to have stable
toolchain: stable
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0 # MSRV
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings

View file

@ -1,39 +0,0 @@
name: Coverage
on:
pull_request:
branches: [main]
push:
branches: [main]
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 unstable-replace unstable-multicall unstable-grouped" --lcov --output-path lcov.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: lcov.info
github-token: ${{ secrets.github_token }}

View file

@ -1,40 +0,0 @@
name: Lint
on:
pull_request:
branches: [main]
push:
branches: [main]
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 unstable-replace unstable-multicall unstable-grouped" -- -D warnings
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

101
.github/workflows/rust-next.yml vendored Normal file
View file

@ -0,0 +1,101 @@
name: rust-next
on:
schedule:
- cron: '3 3 3 * *'
jobs:
test:
name: Test
strategy:
matrix:
build: [linux, windows, mac, beta, nightly, minimal, default]
include:
- build: linux
os: ubuntu-latest
rust: "stable"
features: "full"
- build: windows
os: windows-latest
rust: "stable"
features: "full"
- build: mac
os: macos-latest
rust: "stable"
features: "full"
- build: beta
os: ubuntu-latest
rust: "beta"
features: "full"
- build: nightly
os: ubuntu-latest
rust: "nightly"
features: "full"
- build: minimal
os: ubuntu-latest
rust: "stable"
features: "minimal"
- build: default
os: ubuntu-latest
rust: "stable"
features: "default"
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: make build-${{matrix.features}}
- name: Test
run: make test-${{matrix.features}}
rustfmt:
name: rustfmt
strategy:
matrix:
rust:
- stable
- beta
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: clippy
strategy:
matrix:
rust:
- 1.54.0 # MSRV
- stable
continue-on-error: ${{ matrix.rust != '1.54.0' }} # MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings

View file

@ -137,9 +137,3 @@ members = [
"clap_generate", "clap_generate",
"clap_generate_fig", "clap_generate_fig",
] ]
default-members = [
".",
"clap_derive",
"clap_generate",
"clap_generate_fig",
]

28
Makefile Normal file
View file

@ -0,0 +1,28 @@
# CI Steps
#
# Considerations
# - Easy to debug: show the command being run
# - Leverage CI features: Only run individual steps so we can use features like reporting elapsed time per step
ARGS?=
TOOLCHAIN_TARGET ?=
ifneq (${TOOLCHAIN_TARGET},)
ARGS+=--target ${TOOLCHAIN_TARGET}
endif
_FEATURES = minimal default wasm full release
_FEATURES_minimal = --no-default-features --features "std cargo"
_FEATURES_default =
_FEATURES_wasm = --features "yaml regex unstable-replace unstable-multicall unstable-grouped"
_FEATURES_full = --features "wrap_help yaml regex unstable-replace unstable-multicall unstable-grouped"
_FEATURES_debug = ${_FEATURES_full} --features debug
_FEATURES_release = ${_FEATURES_full} --release
check-%:
cargo check --all-targets ${ARGS} ${_FEATURES_${@:check-%=%}}
build-%:
cargo test --no-run ${ARGS} ${_FEATURES_${@:build-%=%}}
test-%:
cargo test ${ARGS} ${_FEATURES_${@:test-%=%}}