Skip to content

Commit 2726422

Browse files
committed
Improve runtime caching
1 parent 085a8c8 commit 2726422

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

.github/workflows/runtime-osx-arm64.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@ name: Runtime osx-arm64
1313

1414
on:
1515
workflow_dispatch:
16+
inputs:
17+
ignore_cache:
18+
description: 'Force building of the runtime, even if a cached result already exists.'
19+
type: boolean
20+
required: true
21+
default: true
1622
workflow_call:
23+
inputs:
24+
ignore_cache:
25+
description: 'Force building of the runtime, even if a cached result already exists.'
26+
type: boolean
27+
required: false
28+
default: false
1729

1830
env:
1931
RUNTIME: osx-arm64
@@ -38,7 +50,18 @@ jobs:
3850
echo "value=runtime-${{ env.RUNTIME }}-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-osx-arm64.yml') }}" \
3951
>> "$GITHUB_OUTPUT"
4052
53+
- name: Check existing cache
54+
id: cache-check
55+
uses: actions/cache/restore@v4
56+
with:
57+
path: |
58+
Xmss/runtimes/**
59+
key: ${{ steps.cache-key.outputs.value }}
60+
enableCrossOsArchive: true
61+
lookup-only: true
62+
4163
- name: Configure
64+
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
4265
run: >
4366
cmake
4467
-S xmss-library
@@ -49,36 +72,30 @@ jobs:
4972
-DCMAKE_C_FLAGS="-Wno-error=implicit-int-conversion"
5073
5174
- name: Build
75+
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
5276
run: cmake --build build
5377

5478
- name: Test
79+
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
5580
working-directory: build
5681
run: ctest
5782

5883
- name: Copy artifact
84+
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
5985
run: |
6086
mkdir -p "Xmss/runtimes/${{ env.RUNTIME }}/native"
6187
cp build/src/libxmss.dylib "Xmss/runtimes/${{ env.RUNTIME }}/native/xmss.dylib"
6288
63-
- name: Check existing cache
64-
id: cache-check
65-
uses: actions/cache/restore@v4
66-
with:
67-
path: |
68-
Xmss/runtimes/**
69-
key: ${{ steps.cache-key.outputs.value }}
70-
enableCrossOsArchive: true
71-
lookup-only: true
72-
7389
- name: Delete existing cache
74-
if: ${{ steps.cache-check.outputs.cache-hit }}
90+
if: ${{ steps.cache-check.outputs.cache-hit && inputs.ignore_cache }}
7591
run: |
7692
gh extension install actions/gh-actions-cache
7793
gh actions-cache delete "${{ steps.cache-key.outputs.value }}" --confirm
7894
env:
7995
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8096

8197
- name: Save cache
98+
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
8299
uses: actions/cache/save@v4
83100
with:
84101
path: |

0 commit comments

Comments
 (0)