Skip to content

Commit 749d7b6

Browse files
committed
update build workflow
1 parent 35850d6 commit 749d7b6

File tree

3 files changed

+108
-99
lines changed

3 files changed

+108
-99
lines changed

.github/workflows/build.yml

Lines changed: 79 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -11,114 +11,114 @@ jobs:
1111
name: Build for MacOS
1212
runs-on: macos-13
1313
steps:
14-
- name: "Checkout"
14+
- name: Checkout
1515
uses: actions/checkout@v4
16-
- name: "Setup Go"
16+
- name: Setup Go
1717
uses: actions/setup-go@v4
1818
with:
1919
go-version: '^1.18'
20-
- name: "Build"
21-
run: make build_macos
22-
- name: Upload
23-
uses: actions/upload-artifact@v4
20+
- name: Build arm64 gui
21+
uses: ./.github/actions/build.yml
2422
with:
25-
name: macos
26-
path: _output/macos/yarr.app
23+
id: darwin_arm64_gui
24+
cmd: make darwin_arm64_gui
25+
out: out/darwin_arm64_gui/yarr.app
26+
- name: Build amd64 gui
27+
uses: ./.github/actions/build.yml
28+
with:
29+
id: darwin_amd64_gui
30+
cmd: make darwin_amd64_gui
31+
out: out/darwin_amd64_gui/yarr.app
32+
- name: Build arm64
33+
uses: ./.github/actions/build.yml
34+
with:
35+
id: darwin_arm64
36+
cmd: make darwin_arm64
37+
out: out/darwin_arm64/yarr
38+
- name: Build amd64
39+
uses: ./.github/actions/build.yml
40+
with:
41+
id: darwin_amd64
42+
cmd: make darwin_amd64
43+
out: out/darwin_amd64/yarr
2744

2845
build_windows:
2946
name: Build for Windows
3047
runs-on: windows-2022
3148
steps:
32-
- name: "Checkout"
49+
- name: Checkout
3350
uses: actions/checkout@v4
34-
- name: "Setup Go"
51+
- name: Setup Go
3552
uses: actions/setup-go@v4
3653
with:
3754
go-version: '^1.18'
38-
- name: "Build"
39-
run: make build_windows
40-
- name: Upload
41-
uses: actions/upload-artifact@v4
55+
- name: Setup Zig
56+
uses: mlugg/setup-zig@v1
57+
with:
58+
version: 0.14.0
59+
- name: Build arm64 gui
60+
uses: ./.github/actions/build.yml
61+
with:
62+
id: windows_arm64_gui
63+
cmd: make windows_arm64_gui
64+
out: out/windows_arm64_gui/yarr.app
65+
- name: Build amd64 gui
66+
uses: ./.github/actions/build.yml
67+
with:
68+
id: windows_amd64_gui
69+
cmd: make windows_amd64_gui
70+
out: out/windows_amd64_gui/yarr.app
71+
- name: Build arm64
72+
uses: ./.github/actions/build.yml
4273
with:
43-
name: windows
44-
path: _output/windows/yarr.exe
74+
id: windows_arm64
75+
cmd: make windows_arm64
76+
out: out/windows_arm64/yarr
77+
- name: Build amd64
78+
uses: ./.github/actions/build.yml
79+
with:
80+
id: windows_amd64
81+
cmd: make windows_amd64
82+
out: out/windows_amd64/yarr
4583

4684
build_linux:
4785
name: Build for Linux
4886
runs-on: ubuntu-22.04
4987
steps:
50-
- name: "Checkout"
88+
- name: Checkout
5189
uses: actions/checkout@v4
52-
- name: "Setup Go"
90+
- name: Setup Go
5391
uses: actions/setup-go@v4
5492
with:
5593
go-version: '^1.18'
56-
- name: "Build"
57-
run: make build_linux
58-
- name: Upload
59-
uses: actions/upload-artifact@v4
94+
- name: Setup Zig
95+
uses: mlugg/setup-zig@v1
6096
with:
61-
name: linux
62-
path: _output/linux/yarr
63-
64-
build_linux-arm:
65-
name: Build for Linux ARM
66-
runs-on: ubuntu-22.04
67-
steps:
68-
- name: Install dependencies
69-
run: >
70-
sudo apt-get install -y
71-
gcc-arm-linux-gnueabihf
72-
libc6-dev-armhf-cross
73-
- name: "Checkout"
74-
uses: actions/checkout@v4
75-
- name: "Setup Go"
76-
uses: actions/setup-go@v4
97+
version: 0.14.0
98+
- name: Build amd64
99+
uses: ./.github/actions/build.yml
77100
with:
78-
go-version: '^1.18'
79-
- name: "Build"
80-
env:
81-
CC: arm-linux-gnueabihf-gcc
82-
GOARCH: arm
83-
GOARM: 7
84-
run: make build_linux
85-
- name: Upload
86-
uses: actions/upload-artifact@v4
87-
with:
88-
name: linux_arm
89-
path: _output/linux/yarr
90-
91-
build_linux-arm64:
92-
name: Build for Linux ARM64
93-
runs-on: ubuntu-22.04
94-
steps:
95-
- name: Install dependencies
96-
run: >
97-
sudo apt-get install -y
98-
gcc-aarch64-linux-gnu
99-
libc6-dev-arm64-cross
100-
- name: "Checkout"
101-
uses: actions/checkout@v4
102-
- name: "Setup Go"
103-
uses: actions/setup-go@v4
101+
id: windows_amd64
102+
cmd: make windows_amd64
103+
out: out/windows_amd64/yarr
104+
- name: Build arm64
105+
uses: ./.github/actions/build.yml
104106
with:
105-
go-version: '^1.18'
106-
- name: "Build"
107-
env:
108-
CC: aarch64-linux-gnu-gcc
109-
GOARCH: arm64
110-
run: make build_linux
111-
- name: Upload
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: linux_arm64
115-
path: _output/linux/yarr
107+
id: windows_arm64
108+
cmd: make windows_arm64
109+
out: out/windows_arm64/yarr
110+
- name: Build armv7
111+
uses: ./.github/actions/build.yml
112+
with:
113+
id: windows_armv7
114+
cmd: make windows_armv7
115+
out: out/windows_armv7/yarr
116116

117117
create_release:
118118
name: Create Release
119119
runs-on: ubuntu-latest
120-
if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'test') }}
121-
needs: [build_macos, build_windows, build_linux, build_linux-arm, build_linux-arm64]
120+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
121+
needs: [build_macos, build_windows, build_linux]
122122
steps:
123123
- name: Download Artifacts
124124
uses: actions/[email protected]
@@ -127,26 +127,12 @@ jobs:
127127
- name: Preparation
128128
run: |
129129
ls -R
130-
chmod u+x macos/Contents/MacOS/yarr
131-
chmod u+x linux/yarr
132-
chmod u+x linux_arm/yarr
133-
chmod u+x linux_arm64/yarr
134-
135-
mv macos yarr.app && zip -r yarr-${GITHUB_REF_NAME}-macos64.zip yarr.app
136-
( cd windows && zip ../yarr-${GITHUB_REF_NAME}-windows64.zip yarr.exe )
137-
( cd linux && zip ../yarr-${GITHUB_REF_NAME}-linux64.zip yarr )
138-
( cd linux_arm && zip ../yarr-${GITHUB_REF_NAME}-linux_arm.zip yarr )
139-
( cd linux_arm64 && zip ../yarr-${GITHUB_REF_NAME}-linux_arm64.zip yarr )
140130
- name: Upload Release
131+
if: false
141132
uses: softprops/action-gh-release@v2
142133
env:
143134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144135
with:
145136
draft: true
146137
prerelease: true
147-
files: |
148-
yarr-${{ github.ref_name }}-macos64.zip
149-
yarr-${{ github.ref_name }}-windows64.zip
150-
yarr-${{ github.ref_name }}-linux64.zip
151-
yarr-${{ github.ref_name }}-linux_arm.zip
152-
yarr-${{ github.ref_name }}-linux_arm64.zip
138+
files: *.zip

.github/workflows/step-build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build & Upload
2+
inputs:
3+
id:
4+
description: artifact name
5+
required: true
6+
cmd:
7+
description: command to run
8+
required: true
9+
out:
10+
description: path to output file
11+
required: true
12+
runs:
13+
using: composite
14+
steps:
15+
- name: compile
16+
run: ${{ inputs.cmd }}
17+
- name: archive
18+
run: tar -cvf ${{ out }}.tar ${{ out }}
19+
- name: upload
20+
uses: actions/upload-artifact@v4
21+
with:
22+
name: ${{ id }}
23+
path: ${{ out }}.tar

makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ host:
3535
go build $(GO_FLAGS) -o out/yarr ./cmd/yarr
3636

3737
darwin_amd64:
38-
# not supported yet
39-
# CC="zig cc -target x86_64-macos-none" GOOS=darwin GOARCH=arm64 go build $(subst -s ,,$(GO_FLAGS)) -o out/$@/yarr ./cmd/yarr
38+
# cross-compilation not supported: CC="zig cc -target x86_64-macos-none"
39+
GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr
4040

4141
darwin_arm64:
42-
# not supported yet
43-
# CC="zig cc -target aarch64-macos-none" GOOS=darwin GOARCH=arm64 go build $(subst -s ,,$(GO_FLAGS)) -o out/$@/yarr ./cmd/yarr
42+
# cross-compilation not supported: CC="zig cc -target aarch64-macos-none"
43+
GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o out/$@/yarr ./cmd/yarr
4444

4545
linux_amd64:
4646
CC="zig cc -target x86_64-linux-musl -O2 -g0" CGO_CFLAGS="-D_LARGEFILE64_SOURCE" GOOS=linux GOARCH=amd64 \
@@ -69,10 +69,10 @@ darwin_amd64_gui: etc/icon.icns
6969
./etc/macos_package.sh $(VERSION) etc/icon.icns out/$@/yarr out/$@
7070

7171
windows_amd64_gui: windows_versioninfo
72-
GOOS=windows GOARCH=amd64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr ./cmd/yarr
72+
GOOS=windows GOARCH=amd64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr.exe ./cmd/yarr
7373

7474
windows_arm64_gui: src/platform/versioninfo.rc
75-
GOOS=windows GOARCH=arm64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr ./cmd/yarr
75+
GOOS=windows GOARCH=arm64 go build $(GO_FLAGS_GUI_WIN) -o out/$@/yarr.exe ./cmd/yarr
7676

7777
serve:
7878
go run $(GO_FLAGS) ./cmd/yarr -db local.db

0 commit comments

Comments
 (0)