mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
226 lines
6.6 KiB
YAML
226 lines
6.6 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [master, staging, trying]
|
|
pull_request:
|
|
branches: [master]
|
|
types: [opened, reopened, synchronize]
|
|
jobs:
|
|
ci:
|
|
name: CI
|
|
needs: [test, wasm, lint]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Done
|
|
run: exit 0
|
|
prepare:
|
|
name: Prepare
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: styfle/cancel-workflow-action@0.9.0
|
|
with:
|
|
access_token: ${{ github.token }}
|
|
test:
|
|
name: Tests
|
|
needs: [prepare]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
rust: [1.46.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.2
|
|
- 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
|
|
needs: [prepare]
|
|
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.2
|
|
- name: Test all features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --features "wrap_help yaml regex"
|
|
wasm:
|
|
name: Wasm Check
|
|
needs: [prepare]
|
|
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.46.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 (fmt + clippy)
|
|
needs: [prepare]
|
|
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.2
|
|
- 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
|
|
needs: [prepare]
|
|
continue-on-error: true
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install linker
|
|
run: sudo apt-get install libssl-dev cmake pkg-config zlib1g-dev
|
|
- name: Install tarpaulin
|
|
uses: actions-rs/install@v0.1
|
|
with:
|
|
crate: cargo-tarpaulin
|
|
use-tool-cache: true
|
|
- name: Coverage
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: tarpaulin
|
|
args: --features "wrap_help yaml regex" --timeout 300 --out Lcov --output-dir coverage
|
|
- name: Coveralls
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.github_token }}
|