Skip to content

Commit b9c63c9

Browse files
committed
Add caching to github workflow
Now, the workflow doesn't download tarballs on every run.
1 parent a7ab7ce commit b9c63c9

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Build and test
22

3+
concurrency:
4+
group: w64devkit-${{ github.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
pull_request: {}
59
push:
@@ -25,6 +29,9 @@ jobs:
2529
steps:
2630
- uses: actions/checkout@v4
2731

32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
2835
- name: Apply x86 patch
2936
if: matrix.arch == 'x86'
3037
run: patch -p1 -i src/variant-x86.patch
@@ -38,16 +45,26 @@ jobs:
3845
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT
3946
echo "archive=w64devkit-$ARCH-${GIT_VERSION:1}" >> $GITHUB_OUTPUT
4047
41-
- name: Build
48+
- name: Build and extract artifact
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
target: dist
53+
outputs: type=local,dest=.
54+
cache-from: type=gha,scope=w64devkit-${{ matrix.arch }}
55+
cache-to: type=gha,scope=w64devkit-${{ matrix.arch }},mode=max
56+
57+
- name: Rename artifact
4258
run: |
43-
docker build -t w64devkit .
44-
docker run --rm w64devkit > ${{ steps.filename.outputs.archive }}.exe
59+
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.exe
60+
ls -lh ${{ steps.filename.outputs.archive }}.exe
4561
4662
- name: Upload artifact
4763
uses: actions/upload-artifact@v4
4864
with:
49-
name: ${{ steps.filename.outputs.archive }}
50-
path: w64devkit-*.exe
65+
name: ${{ steps.filename.outputs.archive }}.exe
66+
path: ${{ steps.filename.outputs.archive }}.exe
67+
compression-level: 0
5168

5269
- name: Create Release
5370
if: startsWith(github.ref, 'refs/tags/')

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:bookworm-slim
1+
FROM debian:bookworm-slim AS builder
22

33
ARG VERSION=2.4.0
44
ARG PREFIX=/w64devkit
@@ -523,6 +523,11 @@ RUN printf "id ICON \"$PREFIX/src/w64devkit.ico\"" >w64devkit.rc \
523523
&& cat /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/COPYING \
524524
>>$PREFIX/COPYING.MinGW-w64-runtime.txt \
525525
&& echo $VERSION >$PREFIX/VERSION.txt \
526-
&& 7z a -mx=9 -mtm=- $PREFIX.7z $PREFIX
526+
&& 7z a -mx=9 -mtm=- $PREFIX.7z $PREFIX \
527+
&& cat /7z/7z.sfx $PREFIX.7z > /w64devkit.exe
527528
ENV PREFIX=${PREFIX}
528529
CMD cat /7z/7z.sfx $PREFIX.7z
530+
531+
# Minimal stage for CI artifact extraction (optional, doesn't affect default build)
532+
FROM scratch AS dist
533+
COPY --from=builder /w64devkit.exe /w64devkit.exe

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ building the kit itself.
2222

2323
Build the image, then run it to produce a self-extracting 7z archive:
2424

25-
docker build -t w64devkit .
25+
docker build --target builder -t w64devkit .
2626
docker run --rm w64devkit >w64devkit-x64.exe
2727

2828
This takes about 15 minutes on modern systems. You will need an internet

0 commit comments

Comments
 (0)