-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): setup cargo cache to speed up cicd
Signed-off-by: Chawye Hsu <[email protected]>
- Loading branch information
Showing
1 changed file
with
40 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ permissions: | |
contents: write | ||
pull-requests: write | ||
jobs: | ||
# Check code style | ||
check_cargo_style: | ||
# Check code style and tests | ||
check_cargo_base: | ||
name: Check Code Style | ||
runs-on: windows-latest | ||
steps: | ||
|
@@ -20,36 +20,34 @@ jobs: | |
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: clippy, rustfmt | ||
|
||
- name: Setup Cache | ||
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') }} | ||
|
||
- name: Format Check | ||
run: cargo fmt -- --check | ||
|
||
- name: Clippy Check | ||
run: cargo clippy | ||
|
||
# Check tests | ||
check_cargo_test: | ||
name: Check Tests | ||
needs: check_cargo_style | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: stable | ||
|
||
- name: Test Check | ||
- name: Tests Check | ||
run: cargo test --workspace | ||
|
||
# Check build | ||
check_cargo_build: | ||
name: Check Dev Build | ||
needs: check_cargo_test | ||
needs: check_cargo_base | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -65,9 +63,21 @@ jobs: | |
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
|
||
- name: Setup Cache | ||
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') }} | ||
|
||
- name: Build Check | ||
run: cargo build --locked --target ${{ matrix.target }} | ||
|
||
|
@@ -118,9 +128,21 @@ jobs: | |
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
|
||
- name: Setup Cache | ||
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') }} | ||
|
||
- name: Build | ||
uses: actions-rs/[email protected] | ||
with: | ||
|