clap/.github/workflows/ci.yml

187 lines
4.8 KiB
YAML

name: CI
on:
pull_request:
push:
branches: [master]
schedule:
- cron: '3 3 3 * *'
permissions:
contents: read
jobs:
ci:
permissions:
contents: none
name: CI
needs: [test, check, docs, rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Done
run: exit 0
test:
name: Test
strategy:
matrix:
build: [linux, windows, mac, minimal, default, next]
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"
- build: next
os: ubuntu-latest
rust: "stable"
features: "next"
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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}}
- name: Test (benches)
run: make test-${{matrix.features}} ARGS='--workspace --benches'
- name: Test (ultra-minimal)
if: matrix.build == 'minimal'
run: make test-minimal ARGS='--manifest-path Cargo.toml'
check:
name: Check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [msrv, wasm, wasm-wasi, debug, release]
include:
- build: msrv
rust: 1.56.0 # MSRV
target: x86_64-unknown-linux-gnu
features: full
- build: wasm
rust: stable
target: wasm32-unknown-unknown
features: wasm
- build: wasm-wasi
rust: stable
target: wasm32-wasi
features: wasm
- build: debug
rust: stable
target: x86_64-unknown-linux-gnu
features: debug
- build: release
rust: stable
target: x86_64-unknown-linux-gnu
features: release
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v1
- name: Check
run: make check-${{ matrix.features }}
ui:
name: UI Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features: [default, next]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.0 # MSRV
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: UI Tests
run: make test-ui-${{ matrix.features }}
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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: make doc
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.0 # MSRV
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Lint (ultra-minimal)
run: make clippy-minimal ARGS='--manifest-path Cargo.toml'
- name: Lint (minimal)
run: make clippy-minimal
- name: Lint (all)
run: make clippy-full
- name: Lint (release)
run: make clippy-release