fix more things #60
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 workflow to validate PRs and branches are correctly formatted | |
# and pass tests. | |
name: ci | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_INCREMENTAL: 0 | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_HUSKY_DONT_INSTALL_HOOKS: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'ClementTsang/dircs' }} | |
jobs: | |
# Check if things should be skipped. | |
pre-job: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- name: Check if this action should be skipped | |
id: skip_check | |
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
with: | |
skip_after_successful_duplicate: "true" | |
paths: '[".cargo/**", ".github/workflows/ci.yml", "src/**", "tests/**", "Cargo.lock", "Cargo.toml"]' | |
do_not_skip: '["workflow_dispatch", "push"]' | |
# Runs rustfmt + tests + clippy. | |
test: | |
needs: pre-job | |
if: ${{ needs.pre-job.outputs.should_skip != 'true' }} | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 18 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Rust toolchain | |
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
target: x86_64-unknown-linux-gnu | |
- name: Enable Rust cache | |
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609 # 2.7.3 | |
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork | |
with: | |
cache-all-crates: true | |
- name: Check cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Build tests | |
uses: ClementTsang/[email protected] | |
with: | |
command: test | |
args: --no-run --locked | |
env: | |
RUST_BACKTRACE: full | |
- name: Run tests | |
uses: ClementTsang/[email protected] | |
with: | |
command: test | |
args: --no-fail-fast -- --nocapture --quiet | |
env: | |
RUST_BACKTRACE: full | |
- name: Run clippy | |
uses: ClementTsang/[email protected] | |
with: | |
command: clippy | |
args: --all-targets --workspace -- -D warnings | |
cross-version: 0.2.5 | |
env: | |
RUST_BACKTRACE: full |