Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
FM-186: Factor out cache setup
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Aug 15, 2023
1 parent b18850c commit 621583e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/actions/install-tools/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Installs
description: "Install dependencies and tools"
name: Install Tools
description: "Install platform dependencies and tools"
inputs:
repo-token:
description: "secrets.GITHUB_TOKEN"
Expand Down
26 changes: 26 additions & 0 deletions .github/actions/setup-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Setup Cache
description: "Setup Rust artifact caching"
inputs:
name:
description: "Name of the step from the Makefile"
required: true
os:
description: "Name of the OS"
required: true
rust:
description: "Name of the Rust version"
required: true

runs:
using: "composite"

steps:
- name: Setup sccache
uses: hanabi1224/[email protected] # https://github.com/hanabi1224/sccache-action used by Forest.
with:
release-name: v0.3.1
# Caching everything separately, in case they don't ask for the same things to be compiled.
cache-key: ${{ inputs.name }}-${{ inputs.os }}-${{ inputs.rust }}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain', 'rust-toolchain.toml') }}
# Not sure why we should ever update a cache that has the hash of the lock file in it.
# In Forest it only contains the rust-toolchain, so it makes sense to update because dependencies could have changed.
cache-update: false
13 changes: 5 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,14 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup sccache
uses: hanabi1224/[email protected] # https://github.com/hanabi1224/sccache-action used by Forest.
- name: Setup Cache
uses: ./.github/actions/setup-cache
timeout-minutes: 5
continue-on-error: true
with:
release-name: v0.3.1
# Caching everything separately, in case they don't ask for the same things to be compiled.
cache-key: ${{ matrix.make.name }}-${{ matrix.os }}-${{matrix.rust}}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain', 'rust-toolchain.toml') }}
# Not sure why we should ever update a cache that has the hash of the lock file in it.
# In Forest it only contains the rust-toolchain, so it makes sense to update because dependencies could have changed.
cache-update: false
name: ${{ matrix.make.name }}
os: ${{ matrix.os }}
rust: ${{ matrix.rust }}

- name: ${{ matrix.make.name }}
run: make ${{ matrix.make.task }}

0 comments on commit 621583e

Please sign in to comment.