Repository navigation
267 lines (242 loc) · 9.2 KB
/
Copy pathnightly.yml
File metadata and controls
267 lines (242 loc) · 9.2 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
name: Nightly
# Phase 1 (fork testing): triggered on push and dispatch so we iterate
# fast. Phase 2 (upstream): swap the trigger to schedule + fork guard.
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: nightly
cancel-in-progress: true
env:
RUSTUP_TOOLCHAIN: stable
jobs:
# Exit early when master hasn't moved since the last nightly.
check:
runs-on: ubuntu-latest
outputs:
should-build: ${{ steps.compare.outputs.should-build }}
short-sha: ${{ steps.compare.outputs.short-sha }}
date: ${{ steps.compare.outputs.date }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: compare
run: |
nightly_sha=$(git rev-parse nightly^{} 2>/dev/null || echo "none")
head_sha=$(git rev-parse HEAD)
short=$(echo "$head_sha" | head -c 7)
date=$(date -u +%Y-%m-%d)
echo "short-sha=$short" >> "$GITHUB_OUTPUT"
echo "date=$date" >> "$GITHUB_OUTPUT"
if [ "$nightly_sha" = "$head_sha" ]; then
echo "No new commits since the last nightly ($short), skipping."
echo "should-build=false" >> "$GITHUB_OUTPUT"
else
echo "New commits: nightly was $nightly_sha, HEAD is $head_sha"
echo "should-build=true" >> "$GITHUB_OUTPUT"
fi
# -- Gateway: Linux x86_64 and aarch64 --------------------------------
gateway-x64:
needs: check
if: needs.check.outputs.should-build == 'true'
runs-on: ubuntu-22.04
env:
ARTIFACT: gateway-nightly-${{ needs.check.outputs.date }}-${{ needs.check.outputs.short-sha }}-linux-x64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
crates/workshop/package-lock.json
crates/gateway/*/ui/package-lock.json
- name: Install UI dependencies
run: |
npm ci --prefix crates/workshop
npm ci --prefix crates/gateway/config-ui/ui
- name: Build
run: cargo build --release --locked -p gateway
- name: Package
run: |
mkdir -p "$ARTIFACT"
cp target/release/runvil-gateway "$ARTIFACT/"
tar czf "${ARTIFACT}.tar.gz" "$ARTIFACT"
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.ARTIFACT }}.tar.gz
gateway-arm64:
needs: check
if: needs.check.outputs.should-build == 'true'
runs-on: ubuntu-22.04-arm
env:
ARTIFACT: gateway-nightly-${{ needs.check.outputs.date }}-${{ needs.check.outputs.short-sha }}-linux-arm64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
crates/workshop/package-lock.json
crates/gateway/*/ui/package-lock.json
- name: Install UI dependencies
run: |
npm ci --prefix crates/workshop
npm ci --prefix crates/gateway/config-ui/ui
- name: Build
run: cargo build --release --locked -p gateway
- name: Package
run: |
mkdir -p "$ARTIFACT"
cp target/release/runvil-gateway "$ARTIFACT/"
tar czf "${ARTIFACT}.tar.gz" "$ARTIFACT"
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: ${{ env.ARTIFACT }}.tar.gz
# -- Workshop: Windows, macOS ARM, macOS Intel, Linux x64 and ARM64 ----
workshop:
needs: check
if: needs.check.outputs.should-build == 'true'
strategy:
fail-fast: false
matrix:
include:
- name: windows
runs-on: windows-latest
args: ""
suffix: win-x64
- name: macos-arm
runs-on: macos-latest
args: "--target aarch64-apple-darwin"
suffix: macos-arm64
- name: macos-intel
runs-on: macos-latest
args: "--target x86_64-apple-darwin"
suffix: macos-x64
- name: linux
runs-on: ubuntu-22.04
args: ""
suffix: linux-x64
- name: linux-arm
runs-on: ubuntu-22.04-arm
args: ""
suffix: linux-arm64
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- name: Add the Rust target
if: matrix.name == 'macos-arm' || matrix.name == 'macos-intel'
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: |
crates/workshop/package-lock.json
crates/gateway/*/ui/package-lock.json
- name: Install UI dependencies
working-directory: crates/workshop
run: npm ci
- name: Install config UI dependencies
working-directory: crates/gateway/config-ui/ui
run: npm ci
- name: Install Tauri system packages
if: startsWith(matrix.name, 'linux')
run: |
sudo apt-get update
# xdg-utils: the AppImage bundler shells out to xdg-open, which the
# ARM runner images do not preinstall (the x64 image does).
# https://github.com/tauri-apps/tauri-action/issues/1319
sudo apt-get install -y libwebkit2gtk-4.1-dev libssl-dev librsvg2-dev xdg-utils
# tauri.conf.json ships the gateway via bundle.externalBin, which
# resolves binaries/runvil-gateway-<target-triple> at bundle
# time; build and stage it before tauri-action runs.
- name: Build and stage the gateway sidecar
shell: bash
run: |
set -e
case "${{ matrix.name }}" in
windows) triple="x86_64-pc-windows-msvc"; ext=".exe" ;;
macos-arm) triple="aarch64-apple-darwin"; ext="" ;;
macos-intel) triple="x86_64-apple-darwin"; ext="" ;;
linux) triple="x86_64-unknown-linux-gnu"; ext="" ;;
linux-arm) triple="aarch64-unknown-linux-gnu"; ext="" ;;
esac
case "${{ matrix.args }}" in
*--target*)
cargo build --release --locked -p gateway --target "$triple"
src="target/$triple/release/runvil-gateway$ext"
;;
*)
cargo build --release --locked -p gateway
src="target/release/runvil-gateway$ext"
;;
esac
mkdir -p crates/workshop/desktop/binaries
cp "$src" "crates/workshop/desktop/binaries/runvil-gateway-$triple$ext"
- name: Build the app
uses: tauri-apps/tauri-action@84b9d35b5fc46c1e45415bdb6144030364f7ebc5 # v0
with:
projectPath: crates/workshop/desktop
args: ${{ matrix.args }} --config tauri.nightly.conf.json
- name: Upload the installers
uses: actions/upload-artifact@v4
with:
name: workshop-nightly-${{ matrix.suffix }}
path: |
target/**/bundle/nsis/*.exe
target/**/bundle/dmg/*.dmg
target/**/bundle/deb/*.deb
target/**/bundle/appimage/*.AppImage
if-no-files-found: error
# -- Publish: rolling nightly release ----------------------------------
publish:
needs: [check, gateway-x64, gateway-arm64, workshop]
if: needs.check.outputs.should-build == 'true'
runs-on: ubuntu-latest
env:
DATE: ${{ needs.check.outputs.date }}
SHORT_SHA: ${{ needs.check.outputs.short-sha }}
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List artifacts
run: find dist -type f | sort
- name: SHA256SUMS
working-directory: dist
run: |
shopt -s globstar nullglob
sha256sum **/*.tar.gz **/*.exe **/*.dmg **/*.deb **/*.AppImage 2>/dev/null > SHA256SUMS || true
cat SHA256SUMS
- name: Delete the previous nightly release
run: gh release delete nightly --cleanup-tag --yes 2>/dev/null || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create the nightly release
run: |
shopt -s globstar nullglob
gh release create nightly \
--title "Nightly ($DATE, $SHORT_SHA)" \
--prerelease \
--target "$GITHUB_SHA" \
--notes "Automated nightly build from master at $SHORT_SHA ($DATE). Not a stable release." \
dist/**/*.tar.gz dist/**/*.exe dist/**/*.dmg dist/**/*.deb dist/**/*.AppImage dist/SHA256SUMS
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}