-
Notifications
You must be signed in to change notification settings - Fork 34
303 lines (270 loc) · 10 KB
/
Copy pathbuild.yml
File metadata and controls
303 lines (270 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
name: Build cross-platform installers
on:
workflow_dispatch:
inputs:
sine_version:
type: string
description: "Version of Sine (release tag, without 'v')"
required: true
boot_version:
type: string
description: "Version of Sine's bootloader (release tag, without 'v')"
required: true
permissions:
contents: read
attestations: write
id-token: write
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# ================= Windows =================
- os: windows
arch: x64
runner: windows-latest
vs_arch: x64
triplet: x64-windows-static
- os: windows
arch: arm64
runner: windows-11-arm
vs_arch: ARM64
triplet: arm64-windows-static
# ================= Linux =================
- os: linux
arch: x64
runner: ubuntu-latest
generator: Ninja
triplet: x64-linux
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
generator: Ninja
triplet: arm64-linux
# ================= macOS =================
- os: macos
arch: x64
runner: macos-15-intel
generator: Ninja
triplet: x64-osx
- os: macos
arch: arm64
runner: macos-latest
generator: Ninja
triplet: arm64-osx
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Clone external repository
run: |
git clone --recurse-submodules https://github.com/sineorg/installer.git external
# ---------- Linux OpenGL / Wayland / X11 ----------
- name: Install GUI dependencies (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libgl1-mesa-dev \
libegl1-mesa-dev \
libx11-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
libxext-dev \
libxfixes-dev \
libwayland-dev \
libwayland-bin \
wayland-protocols \
libxkbcommon-dev \
libxkbcommon-x11-dev \
extra-cmake-modules
- name: Enable Wayland feature for GLFW (Linux)
if: matrix.os == 'linux'
run: |
python3 -c "
import json
with open('external/vcpkg.json', 'r') as f:
data = json.load(f)
for i, dep in enumerate(data.get('dependencies', [])):
if dep == 'glfw3':
data['dependencies'][i] = {'name': 'glfw3', 'features': ['wayland']}
elif isinstance(dep, dict) and dep.get('name') == 'glfw3':
features = dep.get('features', [])
if 'wayland' not in features:
features.append('wayland')
dep['features'] = features
with open('external/vcpkg.json', 'w') as f:
json.dump(data, f, indent=2)
"
# ---------- Ninja ----------
- name: Install Ninja (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
# ---------- vcpkg ----------
- name: Adjust config for macOS
if: matrix.os == 'macos'
run: |
git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 300
git config --global http.postBuffer 524288000
- name: Setup vcpkg
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11.6
with:
vcpkgDirectory: vcpkg
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
# ---------- Configure ----------
- name: Configure (Windows)
if: matrix.os == 'windows'
run: |
cmake -S external -B build `
-A "$env:ARCH" `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET="$env:TRIPLET" `
-DSINE_VERSION="$env:SINE_VERSION" `
-DBOOT_VERSION="$env:BOOT_VERSION"
env:
VCPKG_ROOT: ${{ github.workspace }}\vcpkg
ARCH: ${{ matrix.vs_arch }}
TRIPLET: ${{ matrix.triplet }}
SINE_VERSION: ${{ inputs.sine_version }}
BOOT_VERSION: ${{ inputs.boot_version }}
- name: Configure (Linux / macOS)
if: matrix.os != 'windows'
run: |
cmake -S external -B build \
-G "${GENERATOR}" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="${VCPKG_DEFAULT_TRIPLET}" \
-DSINE_VERSION=${SINE_VERSION} \
-DBOOT_VERSION=${BOOT_VERSION} \
-DGLFW_BUILD_WAYLAND=ON \
-DGLFW_BUILD_X11=ON
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
GENERATOR: ${{ matrix.generator }}
SINE_VERSION: ${{ inputs.sine_version }}
BOOT_VERSION: ${{ inputs.boot_version }}
# ---------- Build ----------
- name: Build
run: |
cmake --build build --config Release
# ---------- Folder configuration ----------
- name: Ensure artifacts directory
shell: bash
run: |
mkdir -p artifacts/
mkdir -p unsigned/
# ---------- Artifacts ----------
- name: Make executable (Linux/macOS)
if: runner.os != 'Windows'
run: |
chmod +x build/sine_installer
if [[ "$OS" == "linux" ]]; then
cp build/sine_installer artifacts/sine-linux-${ARCH}
elif [[ "$OS" == "macos" ]]; then
cp build/sine_installer artifacts/sine-osx-${ARCH}
fi
env:
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch }}
- name: Prepare executable for upload
if: runner.os == 'Windows'
shell: pwsh
run: |
Copy-Item "build/Release/sine-win-$env:ARCH.exe" -Destination "unsigned/sine-win-$env:ARCH-unsigned.exe"
env:
ARCH: ${{ matrix.arch }}
- name: Upload unsigned Windows executable
if: matrix.os == 'windows'
id: upload-unsigned-artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sine-win-${{ matrix.arch }}-unsigned
path: unsigned/sine-win-${{ matrix.arch }}-unsigned.exe
- name: Upload Linux executable
if: matrix.os == 'linux'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sine-linux-${{ matrix.arch }}
path: artifacts/sine-linux-${{ matrix.arch }}
- name: Upload macOS executable
if: matrix.os == 'macos'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sine-osx-${{ matrix.arch }}
path: artifacts/sine-osx-${{ matrix.arch }}
post-build:
runs-on: ubuntu-latest
needs: build
name: Handle post-build steps
steps:
- name: Check signing requirements
id: status
env:
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "$REF_NAME" == "main" ]]; then
echo "should-sign=yes" >> $GITHUB_OUTPUT
else
echo "should-sign=no" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ./artifacts
- name: Attest artifacts
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: |
./artifacts/sine-linux-*/*
./artifacts/sine-osx-*/*
./artifacts/sine-win-*-unsigned/*
- name: Prepare SignPath Workspace
if: steps.status.outputs.should-sign == 'yes'
run: |
mkdir -p ./unsigned
find ./artifacts/sine-win-*-unsigned/ -type f -exec cp {} ./unsigned/ \;
- name: Upload Windows artifacts (for code signing)
if: steps.status.outputs.should-sign == 'yes'
id: upload-unsigned-zip
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sine-package-for-signing
path: ./unsigned
- name: Submit signing request
if: steps.status.outputs.should-sign == 'yes'
id: signpath-code-signing
uses: signpath/github-action-submit-signing-request@c92b958760219087e01f8d67a1669ed57afe2627 # v2.3
with:
api-token: "${{ secrets.SIGNPATH_API_TOKEN }}"
organization-id: "1324b51a-cb3d-4d1e-aab7-27b1169bd402"
project-slug: "Sine"
signing-policy-slug: "release-signing"
github-artifact-id: "${{ steps.upload-unsigned-zip.outputs.artifact-id }}"
wait-for-completion: false
- name: Save code signing info
if: steps.status.outputs.should-sign == 'yes'
env:
SIGNING_REQUEST_ID: ${{ steps.signpath-code-signing.outputs.signing-request-id }}
SIGNING_REQUEST_WEB_URL: ${{ steps.signpath-code-signing.outputs.signing-request-web-url }}
run: |
mkdir -p artifacts/info
echo "$SIGNING_REQUEST_ID" | tee artifacts/info/signing-request-id.txt
echo "$SIGNING_REQUEST_WEB_URL" | tee artifacts/info/signing-request-web-url.txt
- name: Upload Artifact (signing info)
if: steps.status.outputs.should-sign == 'yes'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: info
path: ./artifacts/info