-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Add a workflow to create cache periodically
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Create cache periodically | ||
|
||
on: | ||
schedule: | ||
# NOTE: | ||
# The cache is valid for 7 days, | ||
# so if we recreate the cache every 6 days, | ||
# the cache will never become invalid. | ||
# (c.f. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy) | ||
- cron: "0 0 */6 * *" | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
otp: 26.0 | ||
rebar3: 3.22.1 | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ env.otp }} | ||
rebar3-version: ${{ env.rebar3 }} | ||
- uses: actions/cache/restore@v4 | ||
id: cache-restore | ||
with: | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
key: ${{ runner.os }}-otp-${{ env.otp }}-rebar3-${{ env.rebar3 }}-${{ hashFiles('rebar.lock') }} | ||
|
||
# NOTE: Create cache data | ||
- run: rebar3 compile | ||
- run: rebar3 as test compile | ||
- run: rebar3 dialyzer | ||
|
||
- uses: actions/cache/save@v4 | ||
if: always() | ||
with: | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
key: ${{ steps.cache-restore.outputs.cache-primary-key }} |