clap/.github/workflows/ci.yml
2020-11-06 21:02:06 +01:00

217 lines
6.2 KiB
YAML

name: CI
on:
push:
branches: [staging, trying]
pull_request:
branches: [master]
types: [opened, reopened, synchronize]
jobs:
ci:
name: CI
needs: [test, test-release, lint, coverage]
runs-on: ubuntu-latest
steps:
- name: Done
run: exit 0
test:
name: Tests
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
rust: 1.42.0
features: none
- os: macos-latest
target: x86_64-apple-darwin
rust: 1.42.0
features: all
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: 1.42.0
features: none
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: 1.42.0
features: all
- os: ubuntu-latest
target: i686-unknown-linux-gnu
rust: 1.42.0
features: none
- os: ubuntu-latest
target: i686-unknown-linux-gnu
rust: 1.42.0
features: all
- os: windows-latest
target: i686-pc-windows-msvc
rust: 1.42.0
features: none
- os: windows-latest
target: i686-pc-windows-msvc
rust: 1.42.0
features: all
- os: windows-latest
target: x86_64-pc-windows-msvc
rust: 1.42.0
features: none
- os: windows-latest
target: x86_64-pc-windows-msvc
rust: 1.42.0
features: all
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: stable
features: none
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: stable
features: all
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: beta
features: none
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: beta
features: all
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-unknown-linux-gnu'
run: sudo apt-get install gcc-5-multilib lib32gcc-5-dev
- 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 "yaml unstable"
test-release:
name: Release Profile Tests
runs-on: ubuntu-latest
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.42.0
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --features "yaml unstable"
nightly:
name: Nightly Tests
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 "yaml unstable"
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.42.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 unstable"
lint:
name: Linting (fmt + clippy)
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 "yaml unstable" -- -D warnings
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
coverage:
name: Coverage
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 "yaml unstable" --timeout 300 --out Lcov --output-dir coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}