name: CI
on:
pull_request:
push:
branches:
- master
- staging
schedule:
- cron: '0 1 * * *'
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
defaults:
run:
shell: bash
jobs:
test:
strategy:
matrix:
include:
- rust: 1.45.2
- rust: stable
- rust: beta
- rust: nightly
- rust: nightly
os: macos-latest
- rust: nightly
os: windows-latest
- rust: nightly
target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v2
- uses: taiki-e/github-actions/install-rust@main
with:
toolchain: ${{ matrix.rust }}
- if: matrix.target == ''
run: cargo install cargo-hack
- if: matrix.target != ''
run: cargo install cross
- if: matrix.target != ''
run: cross test --target ${{ matrix.target }}
- if: matrix.target == ''
run: cargo test --all
- if: matrix.target == ''
run: cargo hack check --all --feature-powerset --no-dev-deps --lib
- if: startsWith(matrix.rust, 'nightly') && !startsWith(matrix.os, 'windows') && matrix.target == ''
run: bash scripts/check-minimal-versions.sh
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: taiki-e/github-actions/install-rust@main
with:
component: clippy
- run: cargo clippy --all --all-features --all-targets
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: taiki-e/github-actions/install-rust@main
with:
component: rustfmt
- run: cargo fmt --all -- --check
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: shellcheck **/*.sh
ci-success:
name: ci
if: github.event_name == 'push' && success()
needs:
- test
- clippy
- rustfmt
- shellcheck
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
run: exit 0
ci-failure:
name: ci
if: github.event_name == 'push' && !success()
needs:
- test
- clippy
- rustfmt
- shellcheck
runs-on: ubuntu-latest
steps:
- name: Mark the job as a failure
run: exit 1