Skip to content

Commit

Permalink
core: workflow cache (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiroaisen authored Jul 22, 2024
2 parents 8ca05e9 + a118636 commit 0e5a935
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 43 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/cargo-build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,22 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
- uses: Swatinem/rust-cache@v2
with:
path: |
./target
~/.cargo
key: ${{ runner.os }}-build-release-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
restore-keys: |
${{ runner.os }}-build-release-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
${{ runner.os }}-build-release-
shared-key: build-release
cache-all-crates: true
cache-targets: true
cache-on-failure: true

# - uses: actions/cache@v4
# with:
# path: |
# ./target
# ~/.cargo
# key: ${{ runner.os }}-build-release-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# restore-keys: |
# ${{ runner.os }}-build-release-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# ${{ runner.os }}-build-release-

# - name: Local cargo cache
# id: build-cargo-cache
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/cargo-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,23 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

- uses: Swatinem/rust-cache@v2
with:
path: |
./target
~/.cargo
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
${{ runner.os }}-build-
shared-key: build
cache-all-crates: true
cache-targets: true
cache-on-failure: true

# - uses: actions/cache@v4
# with:
# path: |
# ./target
# ~/.cargo
# key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# ${{ runner.os }}-build-

# - name: Local cargo cache
# id: build-cargo-cache
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/cargo-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,22 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/cache@v4
- uses: Swatinem/rust-cache@v2
with:
path: |
./target
~/.cargo
key: ${{ runner.os }}-integration-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
restore-keys: |
${{ runner.os }}-integration-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
${{ runner.os }}-integration-
shared-key: integration
cache-all-crates: true
cache-targets: true
cache-on-failure: true

# - uses: actions/cache@v4
# with:
# path: |
# ./target
# ~/.cargo
# key: ${{ runner.os }}-integration-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# restore-keys: |
# ${{ runner.os }}-integration-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# ${{ runner.os }}-integration-

# - name: Local cargo cache
# id: integration-tests-cargo-cache
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/cargo-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,22 @@ jobs:
steps:

- uses: actions/checkout@v4
- uses: actions/cache@v4

- uses: Swatinem/rust-cache@v2
with:
path: |
./target
~/.cargo
key: ${{ runner.os }}-unit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
restore-keys: |
${{ runner.os }}-unit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
${{ runner.os }}-unit-
shared-key: unit
cache-all-crates: true
cache-targets: true
cache-on-failure: true
# - uses: actions/cache@v4
# with:
# path: |
# ./target
# ~/.cargo
# key: ${{ runner.os }}-unit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# restore-keys: |
# ${{ runner.os }}-unit-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# ${{ runner.os }}-unit-

# - name: Local cargo cache
# id: unit-tests-cargo-cache
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
tags:
- "v*.*.*"

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"

jobs:

release:
Expand All @@ -34,16 +38,24 @@ jobs:
# key: release-cargo-target

- uses: actions/checkout@v4
- uses: actions/cache@v4

- uses: Swatinem/rust-cache@v2
with:
path: |
./target
~/.cargo
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
${{ runner.os }}-build-
shared-key: build-release
cache-all-crates: true
cache-targets: true
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/master' }}

# - uses: actions/cache@v4
# with:
# path: |
# ./target
# ~/.cargo
# key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', './rs') }}
# ${{ runner.os }}-build-

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down

0 comments on commit 0e5a935

Please sign in to comment.