Skip to content

Commit beb50ab

Browse files
committed
Add CI build
1 parent caa862c commit beb50ab

3 files changed

Lines changed: 507 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "v*"
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
env:
16+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
17+
18+
jobs:
19+
build:
20+
name: ${{ matrix.name }}
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- name: Windows
27+
os: windows-latest
28+
goos: windows
29+
goarch: amd64
30+
artifact: RayCradleDesktop-windows-amd64
31+
- name: macOS
32+
os: macos-latest
33+
goos: darwin
34+
goarch: ""
35+
artifact: RayCradleDesktop-macos
36+
- name: Linux AppImage
37+
os: ubuntu-24.04
38+
goos: linux
39+
goarch: amd64
40+
artifact: RayCradleDesktop-linux-amd64-appimage
41+
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v5
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v6
48+
with:
49+
go-version-file: go.mod
50+
cache: true
51+
52+
- name: Install Linux build dependencies
53+
if: runner.os == 'Linux'
54+
shell: bash
55+
run: |
56+
set -euo pipefail
57+
sudo apt-get update
58+
sudo apt-get install -y --no-install-recommends \
59+
build-essential \
60+
curl \
61+
desktop-file-utils \
62+
file \
63+
libgtk-3-dev \
64+
libsoup-3.0-dev \
65+
libwebkit2gtk-4.1-dev \
66+
patchelf \
67+
pkg-config \
68+
zip
69+
sudo apt-get install -y --no-install-recommends libfuse2t64 || \
70+
sudo apt-get install -y --no-install-recommends libfuse2 || true
71+
72+
- name: Test
73+
shell: bash
74+
run: |
75+
set -euo pipefail
76+
if [[ "${RUNNER_OS}" == "Linux" ]]; then
77+
go test -tags gtk3 ./...
78+
else
79+
go test ./...
80+
fi
81+
82+
- name: Build release artifact
83+
shell: bash
84+
env:
85+
RAYCRADLE_VERSION: ${{ github.ref_name }}
86+
TARGET_GOOS: ${{ matrix.goos }}
87+
TARGET_GOARCH: ${{ matrix.goarch }}
88+
run: bash scripts/build-release.sh
89+
90+
- name: Verify Windows binary
91+
if: runner.os == 'Windows'
92+
shell: bash
93+
run: |
94+
set -euo pipefail
95+
shopt -s nullglob
96+
exes=(dist/release/*.exe)
97+
if [[ "${#exes[@]}" -eq 0 ]]; then
98+
echo "No Windows .exe was produced in dist/release" >&2
99+
find dist -maxdepth 3 -type f -print >&2 || true
100+
exit 1
101+
fi
102+
for exe in "${exes[@]}"; do
103+
test -s "${exe}"
104+
ls -lh "${exe}"
105+
done
106+
107+
- name: Upload artifact
108+
uses: actions/upload-artifact@v5
109+
with:
110+
name: ${{ matrix.artifact }}
111+
path: dist/release/*
112+
if-no-files-found: error

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ profile.cov
2424
go.work
2525
go.work.sum
2626

27+
# Build artifacts
28+
/dist/
29+
2730
# env file
2831
.env
2932

0 commit comments

Comments
 (0)