Skip to content

Commit

Permalink
Merge pull request #21 from azarashi2931/add-build-cache-to-ci
Browse files Browse the repository at this point in the history
Add build cache to ci
  • Loading branch information
koyashiro authored Feb 15, 2022
2 parents fb97985 + a74ec59 commit 0ae42bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
16 changes: 16 additions & 0 deletions .github/actions/cargo-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Cache .cargo directory
description: Caching .cargo directory
runs:
using: composite
steps:
- name: Cache .cargo directory
uses: actions/cache@v2
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-
4 changes: 4 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/audit.yml"
pull_request:
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/audit.yml"

env:
CARGO_TERM_COLOR: always
Expand All @@ -24,6 +26,8 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/cargo-cache

- name: Security audit
uses: actions-rs/audit-check@v1
with:
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/build.yml"
pull_request:
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/build.yml"

env:
CARGO_TERM_COLOR: always
Expand All @@ -24,15 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: ./.github/actions/cargo-cache

- name: Build
run: cargo build --release --verbose
4 changes: 4 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/clippy.yml"
pull_request:
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/clippy.yml"

env:
CARGO_TERM_COLOR: always
Expand All @@ -24,6 +26,8 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/cargo-cache

- run: rustup component add clippy

- uses: actions-rs/clippy-check@v1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/format.yml"
pull_request:
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/format.yml"

env:
CARGO_TERM_COLOR: always
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: ./.github/actions/cargo-cache

- name: Build
run: cargo build --release --verbose
Expand Down

0 comments on commit 0ae42bf

Please sign in to comment.