Skip to content

Accelerate GitHub Actions workflow #1

Accelerate GitHub Actions workflow

Accelerate GitHub Actions workflow #1

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:
pull_request:
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 }}