Skip to content

Commit

Permalink
Workflow change to cache properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ReCore-sys committed Dec 1, 2024
1 parent 7d07770 commit a3f3199
Showing 1 changed file with 35 additions and 20 deletions.
55 changes: 35 additions & 20 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
name: Rust

on:
pull_request:
branches: [ "master", "rewrite/v3" ]
push:
branches: [ "master", "rewrite/v3" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
format:
name: Check code formatting
Expand All @@ -18,6 +6,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly

Expand All @@ -34,14 +32,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly

- name: Install clippy
run: rustup component add clippy

- name: Run Clippy
run: cargo clippy --all-targets -- -Dwarnings
run: cargo clippy -- -Dwarnings -Dclippy::all

security:
name: Check for security vulnerabilities
Expand All @@ -50,14 +55,24 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly

- name: Install audit
- name: Install cargo-audit
run: cargo install cargo-audit

- name: Run cargo audit
run: cargo install cargo-audit && cargo audit
run: cargo audit

build:
name: Build project
Expand All @@ -76,7 +91,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache dependencies
- name: Restore cargo and target cache
uses: actions/cache@v3
with:
path: |
Expand Down Expand Up @@ -112,7 +127,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache dependencies
- name: Restore cargo and target cache
uses: actions/cache@v3
with:
path: |
Expand Down

0 comments on commit a3f3199

Please sign in to comment.