Skip to content

Commit

Permalink
Merge pull request #2 from bcressey/fix-cache
Browse files Browse the repository at this point in the history
fix and improve GitHub cache action
  • Loading branch information
bcressey authored Jun 16, 2024
2 parents 1d2b91a + 706812b commit 171c24f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ runs:
~/.cargo
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}
- uses: actions/cache@v4
# Cache first-party code dependencies
# Cache Rust dependencies
with:
path: |
.cargo
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/Cargo.lock') }}
- uses: actions/cache@v4
# Cache Go dependencies
with:
path: |
.gomodcache
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/**/go.sum') }}
- run: cargo install cargo-make
shell: bash
- if: ${{ inputs.perform-cache-cleanup }}
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow caches crate dependencies and build artifacts for tools (except 'test-tools' since we don't use them in build workflows).
# This workflow caches crate dependencies, build tools, and external kits.
# The cache is only usable by workflows started from pull requests against the develop branch.
name: CacheDepsAndTools
on:
Expand All @@ -7,6 +7,7 @@ on:
paths:
- '.github/**'
- 'sources/Cargo.lock'
- 'sources/**/go.sum'
- 'Twoliter.toml'
- 'Twoliter.lock'
- 'Makefile'
Expand All @@ -23,6 +24,13 @@ jobs:
uses: ./.github/actions/setup-node
with:
perform-cache-cleanup: true
- run: cargo make install-twoliter
# This installs twoliter.
- run: make prep
# This fetches any external kit dependencies.
- run: make fetch
# This cleans the existing project local caches.
- run: make twoliter purge-cache
# This fetches Rust crate and Go module dependencies.
- run: make twoliter fetch
# This cleans the cargo cache in ~/.cargo
- run: cargo-cache

0 comments on commit 171c24f

Please sign in to comment.