clap/.github/workflows/ci.yml

239 lines
7 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]
2021-05-25 22:42:55 +00:00
concurrency:
group: ci-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
2020-04-20 21:16:33 +00:00
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-04-20 21:16:33 +00:00
test:
name: Tests
strategy:
fail-fast: false
matrix:
rust: [1.54.0, stable, beta]
2020-11-28 00:50:18 +00:00
os: [windows-latest, macos-latest, ubuntu-latest]
target:
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
2021-04-13 21:17:54 +00:00
- i686-pc-windows-gnu
- x86_64-pc-windows-gnu
2020-11-28 00:50:18 +00:00
- 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
2021-04-13 21:17:54 +00:00
- os: macos-latest
target: i686-pc-windows-gnu
- os: macos-latest
target: x86_64-pc-windows-gnu
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
2021-04-13 21:17:54 +00:00
- os: ubuntu-latest
target: i686-pc-windows-gnu
- os: ubuntu-latest
target: x86_64-pc-windows-gnu
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
2021-04-13 21:17:54 +00:00
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
2020-11-06 18:02:43 +00:00
if: matrix.target == 'i686-unknown-linux-gnu'
2021-03-13 06:10:56 +00:00
run: |
sudo apt-get update
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.3
2020-04-20 21:16:33 +00:00
- name: Test all features
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: test
2021-03-13 06:10:56 +00:00
args: --target ${{ matrix.target }} --features "wrap_help yaml regex"
2021-04-13 21:40:37 +00:00
- name: Check debug
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: check
2021-03-13 06:10:56 +00:00
args: --target ${{ matrix.target }} --features "wrap_help yaml regex 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
2021-03-13 06:10:56 +00:00
args: --target ${{ matrix.target }} --features "wrap_help yaml regex" --release
2020-11-06 18:02:43 +00:00
nightly:
name: Nightly Tests
2021-05-25 22:42:55 +00:00
strategy:
fail-fast: false
matrix:
features:
- none
- all
- release
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.3
2020-11-06 18:02:43 +00:00
- name: Test all features
uses: actions-rs/cargo@v1
2021-05-25 22:42:55 +00:00
if: matrix.features == 'all'
2020-11-06 18:02:43 +00:00
with:
command: test
2021-03-13 06:10:56 +00:00
args: --features "wrap_help yaml regex"
2021-05-25 22:42:55 +00:00
- name: Check debug
uses: actions-rs/cargo@v1
if: matrix.features == 'all'
with:
command: check
args: --features "wrap_help yaml regex debug"
- name: Test release
uses: actions-rs/cargo@v1
if: matrix.features == 'release'
with:
command: test
args: --features "wrap_help yaml regex" --release
2020-11-06 18:02:43 +00:00
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.54.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
2021-03-13 06:10:56 +00:00
args: --target ${{ matrix.target }} --features "yaml regex"
2020-10-09 18:48:19 +00:00
lint:
2021-04-13 21:49:19 +00:00
name: Linting
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.3
2020-10-09 18:48:19 +00:00
- name: Clippy for all features
uses: actions-rs/cargo@v1
with:
command: clippy
2021-03-13 06:10:56 +00:00
args: --features "wrap_help yaml regex" -- -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-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: nightly
components: llvm-tools-preview
2020-11-06 18:02:43 +00:00
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Install llvm-cov
2020-10-09 18:48:19 +00:00
uses: actions-rs/install@v0.1
with:
crate: cargo-llvm-cov
version: 0.1.0-alpha.4
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: llvm-cov
args: --features "wrap_help yaml regex" --lcov --output-path lcov.info
2020-11-06 18:02:43 +00:00
- name: Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: lcov.info
2020-11-06 18:02:43 +00:00
github-token: ${{ secrets.github_token }}