Skip to content

Commit

Permalink
Fix CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaccha committed Oct 5, 2024
1 parent 75377bf commit 92566f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/actions/cache_cargo/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ runs:
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner-os }}-cargo-
restore-keys: ${{ runner.os }}-cargo-
22 changes: 18 additions & 4 deletions .github/workflows/rust_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- enhancement**
- bug**
paths:
- 'src/**'
- 'tests/**'
Expand All @@ -14,21 +15,28 @@ on:
branches:
- main


jobs:
build_cache:
name: Cache Rust ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache cargo directory
uses: ./.github/actions/cache_cargo
- name: Set toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Build
run: cargo build
run: cargo build

fmt_clippy:
name: format and clippy
Expand All @@ -37,17 +45,23 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo directory
uses: ./.github/actions/cache_cargo
- name: Check
run: cargo check
- name: Format code
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings --no-deps

test:
name: cargo test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
needs: build_cache
steps:
- name: Checkout code
Expand Down

0 comments on commit 92566f3

Please sign in to comment.