Skip to content

Commit 8a75198

Browse files
committed
Add GitHub Actions build
Add workflow that builds x64/x86 exes, with Docker caching
1 parent 7f50b0a commit 8a75198

3 files changed

Lines changed: 85 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build and test
2+
3+
concurrency:
4+
group: w64devkit-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
pull_request:
10+
branches: [ "master" ]
11+
12+
# Must set Settings -> Actions -> General -> Workflow permissions to
13+
# "Read and write permissions"
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
21+
env:
22+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
arch: ["x64", "x86"]
28+
29+
steps:
30+
- uses: actions/checkout@v6
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v4
34+
35+
- name: Apply x86 patch
36+
if: matrix.arch == 'x86'
37+
run: patch -p1 -i src/variant-x86.patch
38+
39+
- name: Generate archive name and version string
40+
id: filename
41+
env:
42+
ARCH: ${{ matrix.arch }}
43+
run: |
44+
GIT_VERSION="$(git describe --tags --always)"
45+
echo "version=${GIT_VERSION:1}" >> $GITHUB_OUTPUT
46+
echo "archive=w64devkit-$ARCH-${GIT_VERSION:1}" >> $GITHUB_OUTPUT
47+
48+
- name: Build image
49+
uses: docker/build-push-action@v7
50+
with:
51+
context: .
52+
tags: w64devkit:${{ matrix.arch }}
53+
load: true
54+
cache-from: type=gha,scope=w64devkit-${{ matrix.arch }}
55+
cache-to: type=gha,scope=w64devkit-${{ matrix.arch }},mode=max
56+
57+
- name: Extract artifact
58+
run: |
59+
docker run --rm w64devkit:${{ matrix.arch }} > w64devkit.exe
60+
61+
- name: Rename artifact
62+
run: |
63+
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.exe
64+
ls -lh ${{ steps.filename.outputs.archive }}.exe
65+
66+
- name: Upload artifact
67+
uses: actions/upload-artifact@v7
68+
with:
69+
name: ${{ steps.filename.outputs.archive }}.exe
70+
path: ${{ steps.filename.outputs.archive }}.exe
71+
archive: false
72+
73+
- name: Create Release
74+
if: startsWith(github.ref, 'refs/tags/')
75+
uses: softprops/action-gh-release@v2
76+
with:
77+
name: ${{ steps.filename.outputs.version }}
78+
files: w64devkit-*.exe
79+
draft: true

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,5 +777,5 @@ RUN printf "id ICON \"$PREFIX/src/w64devkit.ico\"" >w64devkit.rc \
777777
&& cat /dl/mingw/mingw-w64-libraries/winpthreads/COPYING \
778778
>>$PREFIX/COPYING.MinGW-w64-runtime.txt \
779779
&& echo $VERSION >$PREFIX/VERSION.txt \
780-
&& 7z a -mx=9 -mtm=- $PREFIX.7z $PREFIX
781-
CMD cat /7z/7z.sfx $PREFIX.7z
780+
&& 7z a -mx=9 -mtm=- w64devkit.7z $PREFIX
781+
CMD ["cat", "/7z/7z.sfx", "w64devkit.7z"]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ This takes about 15 minutes on modern systems. You will need an internet
3131
connection during the first few minutes of the build. **Note:** Do not use
3232
PowerShell because it lacks file redirection.
3333

34+
# TEST
35+
Note that if you want a custom build, you can fork the repo, enable github actions
36+
push your commits and download the built artifacts.
37+
3438
## Usage
3539

3640
The self-extracting 7z archive contains tools in a typical unix-like

0 commit comments

Comments
 (0)