Skip to content

Avoid duplicate runs in local PRs #45

Avoid duplicate runs in local PRs

Avoid duplicate runs in local PRs #45

name: (Zeusd) Check format, lint, and test
on:
pull_request:
paths:
- '.github/workflows/zeusd_fmt_lint_test.yaml'
- 'zeusd/**'
push:
paths:
- '.github/workflows/zeusd_fmt_lint_test.yaml'
- 'zeusd/**'
# Jobs initiated by previous pushes get cancelled by a new push.
concurrency:
group: ${{ github.ref }}-zeusd-lint-and-test
cancel-in-progress: true
jobs:
format_lint_test:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: zeusd
- name: Install the Rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
zeusd/target/
key: ${{ github.event.repository.name }}-${{ runner.os }}-cargo-check-v2
- name: Check format
run: cargo fmt --all --check
working-directory: zeusd
- name: Run clippy
run: cargo clippy --all -- -D warnings
working-directory: zeusd
- name: Run tests
run: cargo test
working-directory: zeusd