-
-
Notifications
You must be signed in to change notification settings - Fork 157
334 lines (282 loc) · 12.3 KB
/
build.yml
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: Continuous Integration
on:
merge_group:
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CN_APP_SLUG: verso/verso-nightly
jobs:
pr-fast-check:
if: ${{ github.event_name == 'pull_request' }}
name: Pull Request Fast Check
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- name: Set env
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install build-essential python3-pip ccache clang cmake curl \
g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \
libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \
gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \
libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \
libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \
libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \
libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway \
python3-mako
- name: Check
run: cargo check
build-linux:
if: ${{ github.event_name != 'pull_request' }}
name: Build [Linux]
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: sccache
CCACHE: sccache
SCCACHE_GHA_ENABLED: 'true'
WAYLAND_DISPLAY: wayland-1
WLR_BACKENDS: headless
WLR_LIBINPUT_NO_DEVICES: 1
XDG_RUNTIME_DIR: /tmp
XDG_SESSION_TYPE: wayland
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- name: Install flatpak dependencies
if: ${{ github.event_name == 'schedule' }}
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y --noninteractive flathub org.freedesktop.Platform//23.08
sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk//23.08
sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk.Extension.rust-stable//23.08
sudo flatpak install -y --noninteractive flathub org.freedesktop.Sdk.Extension.llvm18//23.08
- name: Set env
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- name: Run sccache-cache
uses: Mozilla-Actions/[email protected]
- name: Install dependencies for merge group test
if: ${{ github.event_name != 'schedule' }}
run: |
sudo apt-get update
sudo apt install build-essential python3-pip ccache clang cmake curl \
g++ git gperf libdbus-1-dev libfreetype6-dev libgl1-mesa-dri \
libgles2-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good libgstreamer-plugins-good1.0-dev \
gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-ugly gstreamer1.0-plugins-base \
libgstreamer-plugins-base1.0-dev gstreamer1.0-libav \
libgstrtspserver-1.0-dev gstreamer1.0-tools libges-1.0-dev \
libharfbuzz-dev liblzma-dev libunwind-dev libunwind-dev libvulkan1 \
libx11-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libxmu-dev libxmu6 libegl1-mesa-dev llvm-dev m4 xorg-dev sway \
python3-mako
- name: Check for merge group test
if: ${{ github.event_name != 'schedule' }}
run: |
cargo check
# - name: Test
# # Run sway(wayland compositor) in the background, winit will use it
# run: |
# sway > /dev/null 2>&1 &
# cargo test --release
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Generate flatpak cargo sources
if: ${{ github.event_name == 'schedule' }}
run: |
pip3 install aiohttp toml
python3 ./flatpak-cargo-generator.py ./Cargo.lock -o cargo-sources.json
- name: Build and bundle flatpak
if: ${{ github.event_name == 'schedule' }}
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: verso_${{ env.VERSO_VERSION }}_x64.flatpak
manifest-path: org.versotile.verso.yml
cache-key: flatpak-builder-${{ github.sha }}
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: verso_${{ env.VERSO_VERSION }}_x64_flatpak
path: verso_${{ env.VERSO_VERSION }}_x64.flatpak
build-windows:
if: ${{ github.event_name != 'pull_request' }}
name: Build [Windows]
runs-on: windows-latest
env:
CCACHE: sccache
SCCACHE_GHA_ENABLED: 'true'
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install scroop
uses: MinoruSekine/setup-scoop@v3
- name: Install dependencies
run: |
scoop install git llvm cmake curl
python -m pip install mako
- name: Run sccache-cache
uses: Mozilla-Actions/[email protected]
- name: Install Cargo Packager
if: ${{ github.event_name == 'schedule' }}
run: cargo install cargo-packager
- name: Build
run: |
cargo build --release
# - name: Test
# run: |
# cargo test --release
- name: Bundle
if: ${{ github.event_name == 'schedule' }}
run: |
cargo packager --release
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $Env:GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: verso_${{ env.VERSO_VERSION }}_x64_nsis
path: target\release\verso_${{ env.VERSO_VERSION }}_x64-setup.exe
build-macos:
if: ${{ github.event_name != 'pull_request' }}
name: Build [macOS]
strategy:
fail-fast: false
matrix:
platform:
- { target: aarch64-apple-darwin, os: macos-latest, arch: aarch64 }
- { target: x86_64-apple-darwin, os: macos-13, arch: x64 }
runs-on: ${{ matrix.platform.os }}
env:
RUSTC_WRAPPER: sccache
CCACHE: sccache
SCCACHE_GHA_ENABLED: 'true'
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
brew install cmake
python -m pip install mako
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-1.24.6-universal.pkg -o runtime.pkg
sudo installer -pkg runtime.pkg -target /
curl https://gstreamer.freedesktop.org/data/pkg/osx/1.24.6/gstreamer-1.0-devel-1.24.6-universal.pkg -o develop.pkg
sudo installer -pkg develop.pkg -target /
- name: Run sccache-cache
uses: Mozilla-Actions/[email protected]
- name: Install Cargo Packager
if: ${{ github.event_name == 'schedule' }}
run: cargo install cargo-packager
- name: Build
run: |
export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
export DYLD_LIBRARY_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
cargo build --release
# - name: Test
# run: |
# cargo test --release
- name: Bundle
if: ${{ github.event_name == 'schedule' }}
run: |
export PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/bin${PATH:+:$PATH}"
export DYLD_LIBRARY_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
cargo packager --release
- name: Fetch Verso version
if: ${{ github.event_name == 'schedule' }}
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "versoview") | .version')" >> $GITHUB_ENV
- name: Upload artifact
if: ${{ github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: verso_${{ env.VERSO_VERSION }}_${{ matrix.platform.arch }}_dmg
path: target/release/verso_${{ env.VERSO_VERSION }}_${{ matrix.platform.arch }}.dmg
build-result:
name: Build Result
runs-on: ubuntu-latest
if: always()
needs: ['build-macos', 'build-windows', 'build-linux']
steps:
- name: Success
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: exit 0
- name: Failure
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
release-nightly:
if: ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
needs: ['build-macos', 'build-windows', 'build-linux']
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Fetch Verso version
run: |
echo "VERSO_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')" >> $GITHUB_ENV
echo "VERSO_RELEASE_NAME=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "verso") | .version')-$(date '+%Y%m%d')-nightly" >> $GITHUB_ENV
- name: Draft release
uses: crabnebula-dev/[email protected]
id: draft
with:
command: release draft ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}
- name: Upload macOS DMG bundle (ARM)
uses: crabnebula-dev/[email protected]
with:
command: release upload --file "verso_${{ env.VERSO_VERSION }}_aarch64_dmg/verso_${{ env.VERSO_VERSION }}_aarch64.dmg" ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}
- name: Upload macOS DMG bundle (Intel)
uses: crabnebula-dev/[email protected]
with:
command: release upload --file "verso_${{ env.VERSO_VERSION }}_x64_dmg/verso_${{ env.VERSO_VERSION }}_x64.dmg" ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}
- name: Upload Windows NSIS installer
uses: crabnebula-dev/[email protected]
with:
command: release upload --file "verso_${{ env.VERSO_VERSION }}_x64_nsis/verso_${{ env.VERSO_VERSION }}_x64-setup.exe" ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}
- name: Upload Flatpak bundle
uses: crabnebula-dev/[email protected]
with:
command: release upload --file "verso_${{ env.VERSO_VERSION }}_x64_flatpak/verso_${{ env.VERSO_VERSION }}_x64.flatpak" ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}
- name: Publish release
uses: crabnebula-dev/[email protected]
with:
command: release publish ${{ env.CN_APP_SLUG }} $VERSO_RELEASE_NAME
api-key: ${{ secrets.CN_API_KEY }}