Skip to content

Commit

Permalink
WIP: Add a workflow to create cache periodically
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfAfg committed Feb 16, 2024
1 parent c25a5d1 commit e2d14fb
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/create-cache-periodically.yml
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 }}

0 comments on commit e2d14fb

Please sign in to comment.