ci #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main CI pipeline to validate PRs. | |
# | |
# CI pipeline based on: | |
# - https://github.com/heim-rs/heim/blob/master/.github/workflows/ci.yml | |
# - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml | |
# - https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml | |
name: ci | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: "same_content_newer" | |
skip_after_successful_duplicate: "true" | |
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]' | |
do_not_skip: '["workflow_dispatch"]' | |
- uses: actions/checkout@v3 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
- uses: actions-rs/toolchain@v1 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
- run: cargo fmt --all -- --check | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
clippy: | |
needs: [ rustfmt ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
- windows-latest | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: "same_content_newer" | |
skip_after_successful_duplicate: "true" | |
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]' | |
do_not_skip: '["workflow_dispatch"]' | |
- uses: actions/checkout@v3 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
- uses: actions-rs/toolchain@v1 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
- run: cargo clippy --all-targets --workspace -- -D clippy::all -D clippy::pedantic | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
test: | |
needs: [ clippy ] | |
runs-on: ${{ matrix.triple.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
triple: | |
- { | |
os: "ubuntu-latest", | |
target: "x86_64-unknown-linux-gnu", | |
cross: false, | |
rust: stable, | |
} | |
- { | |
os: "macOS-latest", | |
target: "x86_64-apple-darwin", | |
cross: false, | |
rust: stable, | |
} | |
- { | |
os: "windows-latest", | |
target: "x86_64-pc-windows-msvc", | |
cross: false, | |
rust: stable, | |
} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: "same_content_newer" | |
skip_after_successful_duplicate: "true" | |
paths: '[".cargo/**", ".github/workflows/ci.yml", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml"]' | |
do_not_skip: '["workflow_dispatch"]' | |
- uses: actions/checkout@v3 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
- name: Install toolchain | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.triple.rust }} | |
override: true | |
target: ${{ matrix.triple.target }} | |
- uses: Swatinem/rust-cache@v2 | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
with: | |
key: ${{ matrix.triple.target }} | |
- name: Run tests | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
run: cargo test --no-fail-fast | |
env: | |
RUST_BACKTRACE: full |