Skip to content

Commit 036db0a

Browse files
committed
Cache release .build
1 parent f7e27f7 commit 036db0a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,39 @@ jobs:
142142
steps:
143143
- name: GH Runner bug workaround
144144
run: sysctl -w vm.mmap_rnd_bits=28
145+
145146
- name: Checkout code
146147
uses: actions/checkout@v4
147148
with: { 'fetch-depth': 0 }
148-
- name: Test release
149+
150+
- name: Install zstd (for faster caching)
151+
run: apt-get update && apt-get install -y zstd
152+
153+
- name: Restore .build
154+
if: ${{ !(github.run_attempt > 1) }} # Because maybe the cache is causing issues
155+
id: "restore-cache"
156+
uses: actions/cache/restore@v4
157+
with:
158+
path: .build
159+
key: "spi-release-build-${{ runner.os }}-${{ github.event.after }}"
160+
restore-keys: "spi-release-build-${{ runner.os }}-"
161+
162+
- name: Build release
149163
run: |
150164
# Since we're only pinging the version api endpoint, no database is needed and
151165
# we can just copy the development template to ensure the db env variables are set.
152166
cp .env.development.template .env.development
153167
swift build -c release --static-swift-stdlib -Xlinker -ljemalloc --enable-experimental-prebuilts
168+
169+
- name: Cache .build
170+
if: steps.restore-cache.outputs.cache-hit != 'true'
171+
uses: actions/cache/save@v4
172+
with:
173+
path: .build
174+
key: "spi-release-build-${{ runner.os }}-${{ github.event.after }}"
175+
176+
- name: Test release
177+
run: |
154178
$(swift build --show-bin-path -c release)/Run serve --port 8080 --hostname 0.0.0.0 &
155179
sleep 10
156180
echo Probing api/version...

0 commit comments

Comments
 (0)