Files
rustfs/.github/workflows/rust.yml
Nugine 692048d537 ci: improve build workflow (#115)
* ci: fix build workflow

* ci: use setup actions
2024-11-04 15:06:19 +08:00

69 lines
1.5 KiB
YAML

name: Rust
on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
skip-check:
permissions:
actions: write
contents: read
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'
cancel_others: true
paths_ignore: '["*.md"]'
build:
# See this url if required matrix jobs are hanging
# https://github.com/fkirc/skip-duplicate-actions#how-to-use-skip-check-with-required-matrix-jobs
needs: skip-check
if: needs.skip-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
steps:
- uses: arduino/setup-protoc@v3
with:
version: "27.0"
- uses: Nugine/setup-flatc@v1
with:
version: "24.3.25"
- uses: actions/checkout@v4
- name: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo fmt
run: cargo fmt --all --check
- name: cargo clippy
run: cargo clippy -- -D warnings
- name: cargo test
run: cargo test --all --exclude e2e_test