clap/.github/workflows/ci.yml

207 lines
6 KiB
YAML
Raw Normal View History

2020-04-20 21:16:33 +00:00
name: CI
on:
push:
2020-11-28 00:50:18 +00:00
branches: [master, staging, trying]
2020-04-20 21:16:33 +00:00
pull_request:
branches: [master]
types: [opened, reopened, synchronize]
jobs:
ci:
name: CI
2020-11-28 00:50:18 +00:00
needs: [test, wasm, lint]
runs-on: ubuntu-latest
steps:
- name: Done
run: exit 0
2020-11-28 00:50:18 +00:00
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
2020-04-20 21:16:33 +00:00
test:
name: Tests
2020-11-28 00:50:18 +00:00
needs: [prepare]
2020-04-20 21:16:33 +00:00
strategy:
fail-fast: false
matrix:
2020-11-28 00:50:18 +00:00
rust: [1.46.0, stable, beta]
os: [windows-latest, macos-latest, ubuntu-latest]
target:
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
- 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
2020-11-06 18:02:43 +00:00
target: x86_64-apple-darwin
- os: windows-latest
2020-11-28 00:50:18 +00:00
target: x86_64-unknown-linux-gnu
2020-11-06 18:02:43 +00:00
- os: windows-latest
2020-11-28 00:50:18 +00:00
target: i686-unknown-linux-gnu
- os: macos-latest
2020-11-06 18:02:43 +00:00
target: i686-pc-windows-msvc
2020-11-28 00:50:18 +00:00
- os: macos-latest
2020-11-06 18:02:43 +00:00
target: x86_64-pc-windows-msvc
2020-11-28 00:50:18 +00:00
- os: macos-latest
2020-04-20 21:16:33 +00:00
target: x86_64-unknown-linux-gnu
2020-11-28 00:50:18 +00:00
- os: macos-latest
target: i686-unknown-linux-gnu
2020-04-20 21:16:33 +00:00
- os: ubuntu-latest
2020-11-28 00:50:18 +00:00
target: i686-pc-windows-msvc
2020-04-20 21:16:33 +00:00
- os: ubuntu-latest
2020-11-28 00:50:18 +00:00
target: x86_64-pc-windows-msvc
2020-04-20 21:16:33 +00:00
- os: ubuntu-latest
2020-11-28 00:50:18 +00:00
target: x86_64-apple-darwin
2020-04-20 21:16:33 +00:00
runs-on: ${{ matrix.os }}
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
2020-10-09 18:48:19 +00:00
profile: minimal
2020-04-20 21:16:33 +00:00
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
2020-11-06 18:02:43 +00:00
- name: Checkout
uses: actions/checkout@v2
- name: Install linker
if: matrix.target == 'i686-unknown-linux-gnu'
2021-02-12 03:58:52 +00:00
run: sudo apt-get install gcc-multilib
2020-04-20 21:16:33 +00:00
- 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
2020-04-20 21:16:33 +00:00
- name: Test all features
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: test
2020-11-28 00:50:18 +00:00
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable"
- name: Check debug statement
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: check
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable debug"
2020-11-28 00:50:18 +00:00
- name: Test release
2020-04-20 21:16:33 +00:00
uses: actions-rs/cargo@v1
2020-11-28 00:50:18 +00:00
if: matrix.features == 'release'
2020-04-20 21:16:33 +00:00
with:
command: test
2020-11-28 00:50:18 +00:00
args: --target ${{ matrix.target }} --features "wrap_help yaml regex unstable" --release
2020-11-06 18:02:43 +00:00
nightly:
name: Nightly Tests
2020-11-28 00:50:18 +00:00
needs: [prepare]
2020-11-06 18:02:43 +00:00
runs-on: ubuntu-latest
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
2020-04-20 21:16:33 +00:00
with:
2020-11-06 18:02:43 +00:00
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
2020-11-28 00:50:18 +00:00
args: --features "wrap_help yaml regex unstable"
2020-11-06 18:02:43 +00:00
wasm:
name: Wasm Check
2020-11-28 00:50:18 +00:00
needs: [prepare]
2020-11-06 18:02:43 +00:00
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:
2020-11-28 00:50:18 +00:00
toolchain: 1.46.0
2020-11-06 18:02:43 +00:00
target: ${{ matrix.target }}
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
2020-11-28 00:50:18 +00:00
args: --target ${{ matrix.target }} --features "yaml regex unstable"
2020-10-09 18:48:19 +00:00
lint:
name: Linting (fmt + clippy)
2020-11-28 00:50:18 +00:00
needs: [prepare]
2020-10-09 18:48:19 +00:00
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
2020-11-28 00:50:18 +00:00
args: --features "wrap_help yaml regex unstable" -- -D warnings
2020-10-09 18:48:19 +00:00
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
2020-11-06 18:02:43 +00:00
coverage:
name: Coverage
2020-11-28 00:50:18 +00:00
needs: [prepare]
2020-11-13 23:39:23 +00:00
continue-on-error: true
2020-11-06 18:02:43 +00:00
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
2020-10-09 18:48:19 +00:00
uses: actions-rs/install@v0.1
with:
2020-11-06 18:02:43 +00:00
crate: cargo-tarpaulin
2020-10-09 18:48:19 +00:00
use-tool-cache: true
2020-11-06 18:02:43 +00:00
- name: Coverage
uses: actions-rs/cargo@v1
with:
command: tarpaulin
2020-11-28 00:50:18 +00:00
args: --features "wrap_help yaml regex unstable" --timeout 300 --out Lcov --output-dir coverage
2020-11-06 18:02:43 +00:00
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}