forked from axolotl-chat/axolotl
-
Notifications
You must be signed in to change notification settings - Fork 0
296 lines (250 loc) · 10.1 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
name: Axolotl build pipeline
on:
workflow_call:
workflow_dispatch:
env:
NODE_VERSION: "18.x"
jobs:
build-axolotl-web:
name: Build axolotl-web
runs-on: ubuntu-latest
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Check out code
uses: actions/checkout@v4
- name: Download dependencies
run: make download-dependencies-axolotl-web
- name: Build
run: make build-axolotl-web
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: axolotl-web
path: axolotl-web/dist/
retention-days: 1
build-axolotl:
name: Build axolotl
runs-on: ubuntu-latest
needs:
- build-axolotl-web
steps:
- name: Install tauri dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.1-dev librsvg2-dev libayatana-appindicator3-dev libssl-dev libjavascriptcoregtk-4.1-dev
- name: Install protoc
run: sudo apt-get install protobuf-compiler
- name: Rust setup
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Check out code
uses: actions/checkout@v4
- name: Download axolotl-web build artifacts
uses: actions/download-artifact@v4
id: download
with:
name: axolotl-web
path: build-artifacts
- name: Copy axolotl-web build artifacts
run: |
mkdir --parents axolotl-web/dist
cp -rf ${{steps.download.outputs.download-path}}/* axolotl-web/dist
- name: Build
run: make build-axolotl
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-amd64
path: target/release/axolotl
retention-days: 1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn --cwd ./axolotl-web install --frozen-lockfile
- name: Install and cache tauri-cli
uses: baptiste0928/cargo-install@v3
with:
crate: tauri-cli
version: '^2.0.0-rc'
- name: Build deb package
run: cargo tauri build --ci --features tauri --bundles deb
- name: Upload deb package
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-amd64-deb
path: target/release/bundle/deb/*.deb
retention-days: 1
- name: Build appimage package
run: cargo tauri build --ci --features tauri --bundles appimage
- name: Upload appimage package
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-amd64-appimage
path: target/release/bundle/appimage/*.AppImage
retention-days: 1
smoketest:
name: Smoke test
runs-on: ubuntu-latest
needs:
- build-axolotl
steps:
- name: Install tauri dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-0
- name: Download build artifacts
uses: actions/download-artifact@v4
id: download-axolotl-linux-amd64
with:
name: build-axolotl-linux-amd64
- name: Run axolotl binary
run: |
AXOLOTL="${{steps.download-axolotl-linux-amd64.outputs.download-path}}/axolotl"
chmod +x ${AXOLOTL}
${AXOLOTL} --help
build-axolotl-arm64:
name: Build axolotl arm64
runs-on: ubuntu-latest
needs:
- build-axolotl-web
steps:
- name: Install tools
run: |
sudo apt-get update && sudo apt-get install -y ca-certificates curl
- name: Install protoc
run: sudo apt-get install protobuf-compiler
- name: Install tauri arm64 dependencies
run: |
sudo dpkg --add-architecture arm64
sudo sed -i '/^deb \[/! s/^deb /deb [arch=amd64] /' /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy main multiverse universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-security main multiverse universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-backports main multiverse universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main multiverse universe" | sudo tee -a /etc/apt/sources.list
sudo apt-get update && sudo apt-get install -y --no-install-recommends libgtk-3-dev:arm64 libwebkit2gtk-4.1-dev:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64 libssl-dev:arm64 libjavascriptcoregtk-4.1-dev:arm64
- name: Rust setup
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-linux-gnu
- name: Setup C compiler, linker and pkgconfig
run: |
sudo apt-get install -y g++ g++-aarch64-linux-gnu
echo "HOST_CC=gcc" >> $GITHUB_ENV
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v4
- name: Download build-axolotl-web build artifacts
uses: actions/download-artifact@v4
id: download-axolotl-web
with:
name: axolotl-web
path: build-artifacts
- name: Copy axolotl-web build artifacts
run: |
mkdir --parents axolotl-web/dist
cp -rf ${{steps.download-axolotl-web.outputs.download-path}}/* axolotl-web/dist
- name: Build
run: cargo build --target aarch64-unknown-linux-gnu --release --features tauri
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-arm64
path: target/aarch64-unknown-linux-gnu/release/axolotl
retention-days: 1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn --cwd ./axolotl-web install --frozen-lockfile
- name: Install and cache tauri-cli
uses: baptiste0928/cargo-install@v3
with:
crate: tauri-cli
version: '^2.0.0-rc'
- name: Build deb package
run: cargo tauri build --ci --target aarch64-unknown-linux-gnu --features tauri --bundles deb
- name: Upload deb package
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-arm64-deb
path: target/aarch64-unknown-linux-gnu/release/bundle/deb/*.deb
retention-days: 1
package-click:
strategy:
matrix:
arch: [armhf, arm64, amd64]
name: Package as click ${{ matrix.arch }}
runs-on: ubuntu-latest
needs:
- build-axolotl-web
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download axolotl-web build artifacts
uses: actions/download-artifact@v4
id: download-axolotl-web
with:
name: axolotl-web
path: build-artifacts
- name: Put axolotl web in place
run: |
mkdir -p $GITHUB_WORKSPACE/build/all/axolotlweb/install/axolotl-web/dist
cp -rf ${{steps.download-axolotl-web.outputs.download-path}}/* $GITHUB_WORKSPACE/build/all/axolotlweb/install/axolotl-web/dist
# workaround for https://gitlab.com/clickable/clickable/-/issues/422
mkdir -p $GITHUB_WORKSPACE/build/{arm-linux-gnueabihf,aarch64-linux-gnu,x86_64-linux-gnu}/
ln -s ../all/axolotlweb $GITHUB_WORKSPACE/build/arm-linux-gnueabihf/axolotlweb
ln -s ../all/axolotlweb $GITHUB_WORKSPACE/build/aarch64-linux-gnu/axolotlweb
ln -s ../all/axolotlweb $GITHUB_WORKSPACE/build/x86_64-linux-gnu/axolotlweb
- name: Build click (${{ matrix.arch }})
# workaround https://github.com/actions/runner/issues/1479#issuecomment-969306629
uses: ChristopherHX/conditional@01004426dfbc58dc9bfe0713f146f1429eb5025e # main
with:
step: |
uses: docker://clickable/ci-20.04-${{ matrix.arch }}:8.2.0
with:
args: clickable build --verbose -a ${{ matrix.arch }}
- name: Upload the built click artifact (${{ matrix.arch }})
uses: actions/upload-artifact@v4
with:
name: build-axolotl-linux-${{ matrix.arch }}-click
path: build/*/app/axolotl.nanuc_*.click
retention-days: 1
# See https://github.com/flatpak/flatpak-github-actionsfor examples
# It also contains instructions on how to compile for other architectures via QEMU
flatpak:
name: Flatpak
strategy:
matrix:
variant:
- arch: x86_64
runner: ubuntu-latest
- arch: aarch64
runner: ARM64
# Don't fail the whole workflow if one architecture fails
fail-fast: false
runs-on: ${{ matrix.variant.runner }}
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-46
options: --privileged
steps:
- uses: actions/checkout@v4
- id: flatpak-branch
# Flatpak branch musn't contain "/" but dependabot branches do
run: echo "branch=$(echo ${{ github.head_ref || github.ref_name }} | sed 's$/$_$g')" >> $GITHUB_OUTPUT
- uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
bundle: axolotl.flatpak
manifest-path: flatpak/org.nanuc.Axolotl.yml
branch: ${{ steps.flatpak-branch.outputs.branch }}
arch: ${{ matrix.variant.arch }}
build-bundle: true
upload-artifact: true