Skip to content

Commit a6ae204

Browse files
committed
attempt linux caching for opam deps. REVER THIS COMMIT if the next release workflow breaks for linux!
1 parent 7be5df8 commit a6ae204

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

‎.github/workflows/release.yml‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,28 @@ jobs:
2828
persist-credentials: false
2929
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
3030

31+
# Unlike the macOS build, Linux does not use ocaml/setup-ocaml because the release binary must be built against musl.
32+
# Cache Docker layers here instead because that is where the Linux release build's opam deps are installed.
33+
- name: Cache Docker layers
34+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
35+
with:
36+
path: /tmp/.buildx-cache
37+
key: linux-docker-${{ hashFiles('Dockerfile', 'strings.opam') }}
38+
restore-keys: |
39+
linux-docker-
40+
3141
- name: Build Linux binary (Docker)
3242
run: |
3343
set -euo pipefail
34-
docker build . -t strings:latest
44+
docker buildx create --use
45+
docker buildx build \
46+
--cache-from type=local,src=/tmp/.buildx-cache \
47+
--cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max \
48+
--load \
49+
-t strings:latest \
50+
.
51+
rm -rf /tmp/.buildx-cache
52+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
3553
STRINGS_CID="$(docker create strings:latest)"
3654
rm -rf strings.linux strings.linux.tar.gz lib
3755
docker cp "$STRINGS_CID":/app/strings.exe strings.linux

0 commit comments

Comments
 (0)