mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
181 lines
4.6 KiB
YAML
181 lines
4.6 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '**'
|
|
- '!/*.md'
|
|
- '!/docs/**'
|
|
- "!/LICENSE-*"
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '**'
|
|
- '!/*.md'
|
|
- '!/docs/**'
|
|
- "!/LICENSE-*"
|
|
schedule:
|
|
- cron: '3 3 3 * *'
|
|
jobs:
|
|
ci:
|
|
name: CI
|
|
needs: [smoke, test, check, docs, rustfmt, clippy]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Done
|
|
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:
|
|
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:
|
|
fail-fast: false
|
|
matrix:
|
|
build: [msrv, wasm, wasm-wasi, debug, release]
|
|
include:
|
|
- build: msrv
|
|
rust: 1.54.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@v2
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
target: ${{ matrix.target }}
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v1
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Check
|
|
run: make check-${{ matrix.features }}
|
|
docs:
|
|
name: Docs
|
|
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
|