-
-
Notifications
You must be signed in to change notification settings - Fork 32
53 lines (48 loc) · 1.46 KB
/
test-cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Test cache
on:
push:
branches:
- 'main'
- 'releases/**'
pull_request:
workflow_dispatch:
jobs:
test_cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache
with:
path: ${{ runner.temp }}/test_cache.img
key: ${{ hashFiles('**/test-cache.yml') }}-${{ hashFiles('**/*.sh') }}
- uses: ./ # pguyot/arm-runner-action@HEAD
id: install_deps
if: steps.cache.outputs.cache-hit != 'true'
with:
# we don't want to optimize as it's two-stage
optimize_image: no
commands: |
set -e
test ! -f /usr/games/fortune
apt update
apt install -y fortunes-min fortune cowsay
- name: Move and rename image with dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
mv ${{ steps.install_deps.outputs.image }} ${{ runner.temp }}/test_cache.img
- uses: ./ # pguyot/arm-runner-action@HEAD
with:
base_image: file://${{ runner.temp }}/test_cache.img
commands: |
/usr/games/fortune /usr/share/games/fortunes/fortunes | /usr/games/cowsay
check_cache:
runs-on: ubuntu-latest
needs: [test_cache]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ runner.temp }}/test_cache.img
key: ${{ hashFiles('**/test-cache.yml') }}-${{ hashFiles('**/*.sh') }}
fail-on-cache-miss: true