Skip to content

Commit

Permalink
Add caching for .cargo directory and create CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uzimaru0000 committed Dec 29, 2023
1 parent b0b0a87 commit b7af1d3
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/cache_cargo/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: cache_cargo
description: caching .cargo directory
runs:
using: composite

steps:
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
server/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on: push

jobs:
build_cache:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/cache_cargo
- name: build
run: cargo build

fmt:
runs-on: ubuntu-latest
needs: build_cache
steps:
- uses: actions/checkout@v2
- run: rustup component add rustfmt
- uses: ./.github/actions/cache_cargo
- name: fmt
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
needs: build_cache
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- uses: ./.github/actions/cache_cargo
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings

test:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
needs: build_cache
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/cache_cargo
- name: test
run: cargo test --all -- --nocapture

0 comments on commit b7af1d3

Please sign in to comment.