-
Notifications
You must be signed in to change notification settings - Fork 61
354 lines (315 loc) · 12.3 KB
/
main_ci.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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
name: MAIN_CI
on:
push:
branches: [ main ]
paths-ignore:
- '.github/workflows/app_ci.yml'
- 'target_root_app/**'
- 'doc/**'
- 'tutorial/**'
- 'README.md'
- 'README_zh_CN.md'
- 'DEVELOPNOTE.md'
- 'CHANGELOG.md'
- '.readthedocs.yaml'
pull_request:
branches: [ main ]
paths-ignore:
- '.github/workflows/app_ci.yml'
- 'target_root_app/**'
- 'doc/**'
- 'tutorial/**'
- 'README.md'
- 'README_zh_CN.md'
- 'DEVELOPNOTE.md'
- 'CHANGELOG.md'
- '.readthedocs.yaml'
workflow_dispatch:
jobs:
main_build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: clean
shell: bash -l {0}
run: |
rm -rf ./.git
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
- name: Install prerequisites
shell: bash -l {0}
run: |
sudo apt update
sudo apt install -y wget device-tree-compiler ninja-build git build-essential flex \
pkg-config zlib1g-dev libsdl2-dev libglib2.0-0 libglib2.0-dev libsdl1.2-dev \
libpixman-1-dev libfdt-dev autoconf automake libtool librbd-dev libmpc-dev \
libaio-dev make cmake gcc python3 vim swig python3-dev libedit-dev mtd-utils \
libncurses5-dev liblzma-dev lua5.3 liblua5.3-dev libxml2-dev doxygen graphviz \
libgtk-3-dev libcap-ng-dev libattr1-dev bison gperf intltool libslirp-dev \
libvirglrenderer-dev libsdl2-image-dev
- name: Cache toolchain
uses: actions/cache@v4
env:
cache-name: toolchain
with:
path: |
$HOME/gcc-riscv64-unknown-linux-gnu
$HOME/gcc-riscv64-unknown-elf
key: ${{ runner.os }}-cache-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-cache-
- name: Download and extract prebuilt toolchain
shell: bash -l {0}
run: |
RISCV_GLIBC_TOOLCHAIN=$HOME/gcc-riscv64-unknown-linux-gnu
RISCV_NEWLIBC_TOOLCHAIN=$HOME/gcc-riscv64-unknown-elf
if [ ! -d "$RISCV_GLIBC_TOOLCHAIN" ]; then
# download prebuilt toolchain
wget https://github.com/riscv/riscv-gnu-toolchain/releases/download/2021.08.07/riscv64-glibc-ubuntu-20.04-nightly-2021.08.07-nightly.tar.gz
tar -xzf riscv64-glibc-ubuntu-20.04-nightly-2021.08.07-nightly.tar.gz
mv riscv $RISCV_GLIBC_TOOLCHAIN
rm -f *.tar.gz
# strip binaries
cd $RISCV_GLIBC_TOOLCHAIN
set +e
for i in `find libexec bin -type f`
do
strip -s $i
done
cd -
$RISCV_GLIBC_TOOLCHAIN/bin/riscv64-unknown-linux-gnu-gcc -v
fi
if [ ! -d "$RISCV_NEWLIBC_TOOLCHAIN" ]; then
# download prebuilt toolchain
wget https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
tar -xzf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
mv riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14 $RISCV_NEWLIBC_TOOLCHAIN
rm -f *.tar.gz
# strip binaries
cd $RISCV_NEWLIBC_TOOLCHAIN
set +e
for i in `find libexec bin -type f`
do
strip -s $i
done
cd -
$RISCV_NEWLIBC_TOOLCHAIN/bin/riscv64-unknown-elf-gcc -v
fi
- name: Build all
shell: bash -l {0}
run: |
# replace pkexec with sudo for ci
sed -i 's/pkexec/sudo/g' build.sh
export TOOLCHAIN_ROOT_PATH=$HOME
./build.sh all
# perupload
sudo rm -rf ./output/rootfs/bootfs ./output/rootfs/rootfs ./output/rootfs/target
tar -czf output.tar.gz output/ update_tools/ run.sh update_tools.sh
tar -czf toolchain.tar.gz $HOME/gcc-riscv64-unknown-linux-gnu $HOME/gcc-riscv64-unknown-elf
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: output
path: |
output.tar.gz
retention-days: 1
- name: Upload prebuilt toolchain
uses: actions/upload-artifact@v4
with:
name: prebuilt_toolchain
path: |
toolchain.tar.gz
qemu_w64_build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: clean
shell: bash -l {0}
run: |
rm -rf ./.git
- name: build_docker_image
shell: bash -l {0}
run: |
cd qemu-8.0.0
./tests/docker/docker.py --engine docker build -t qemu/fedora -f tests/docker/dockerfiles/fedora-win64-cross.docker --registry registry.gitlab.com/qemu-project/qemu --add-current-user
- uses: addnab/docker-run-action@v3
with:
image: qemu/fedora:latest
options: -w /home/runner/work/quard_star_tutorial/quard_star_tutorial -v /home/runner:/home/runner
shell: bash -l {0}
run: |
dnf update -y
dnf install -y zstd wget
wget https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-libslirp-4.7.0-1-any.pkg.tar.zst
tar -I zstd -xvf mingw-w64-x86_64-libslirp-4.7.0-1-any.pkg.tar.zst
cp ./mingw64/bin/libslirp-0.dll /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libslirp-0.dll
mkdir /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp
cp ./mingw64/include/slirp/libslirp-version.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp/libslirp-version.h
cp ./mingw64/include/slirp/libslirp.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp/libslirp.h
cp ./mingw64/lib/libslirp.a /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libslirp.a
cp ./mingw64/lib/libslirp.dll.a /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libslirp.dll.a
cp ./.github/workflows/res/slirp.pc /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/slirp.pc
./build.sh qemu_w64
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll ./output/qemu_w64/
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: qemu_w64
path: |
output/qemu_w64
run.bat
retention-days: 1
qemu_macos_build:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- name: clean
shell: bash -l {0}
run: |
rm -rf ./.git
- name: Install prerequisites
run: |
brew install libslirp libffi gettext glib pkg-config autoconf automake pixman ninja dylibbundler
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
- name: Build all
shell: bash -l {0}
run: |
conda init
conda create -n build_env python=3.11.5 -y
conda activate build_env
./build.sh qemu_macos
dylibbundler -od -b -x ./output/qemu_macos/bin/qemu-system-riscv64 -d ./output/qemu_macos/libs/
tar -czf qemu_macos.tar.gz output/
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: qemu_macos
path: |
qemu_macos.tar.gz
retention-days: 1
quard_star_tools_build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.5.3'
modules: 'qt5compat qtwebsockets qtmultimedia'
aqtversion: ==3.1.7
- name: Install prerequisites
shell: bash -l {0}
run: |
sudo apt update
sudo apt install -y make gcc upx-ucl
- name: build depend
run: |
cd quard_star_tools/depend
sudo apt install fcitx-libs-dev qtbase5-private-dev libxkbcommon-dev extra-cmake-modules tree
export PATH=$Qt6_DIR/bin:$PATH
export PATH=$Qt6_DIR/../../Qt/Tools/CMake/bin:$PATH
export Qt6GuiTools_DIR=$Qt6_DIR
./build_fcitx_qt6.sh
cp ./fcitx-qt5-1.2.7/build/qt6/platforminputcontext/libfcitxplatforminputcontextplugin-qt6.so ./
- name: Build all
shell: bash -l {0}
run: |
cd quard_star_tools
git describe --always --long --abbrev=10 --exclude '*' | awk '{print "\""$0"\""}' > git_tag.inc
sed -i 's/git_tag.inc/git_tag.ci.inc/g' quard_star_tools.pro
sed -i 's/upx-ucl/cp $$DESTDIR\/$$TARGET $$DESTDIR\/quard_star_tools_temp; upx-ucl/g' quard_star_tools.pro
lrelease quard_star_tools.pro
qmake -makefile
make
cd ./tools/ci_build_deb
./build.sh
cd -
mkdir gui_tools
mv ./release/output ./gui_tools/quard_star_tools
tar -czf quard_star_tools.tar.gz gui_tools/ run_quard_star_tools.sh
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: quard_star_tools
path: |
./quard_star_tools/quard_star_tools.tar.gz
retention-days: 1
quard_star_tools_w64_build:
runs-on: windows-2022
steps:
- name: sparseCheckout
run: |
git clone --filter=blob:none --no-checkout --depth 1 --single-branch -b "$env:GITHUB_REF".Split('/')[2] --sparse "https://$env:GITHUB_ACTOR:$env:[email protected]/$env:GITHUB_REPOSITORY.git" .
git config core.protectNTFS false
git sparse-checkout init --cone
git sparse-checkout add quard_star_tools
git checkout
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
arch: win64_mingw
version: '6.5.3'
modules: 'qt5compat qtwebsockets qtmultimedia'
aqtversion: ==3.1.7
- name: Build all
run: |
cd quard_star_tools
git describe --always --long --abbrev=10 --exclude '*' | ./tools/awk/awk.exe '{print "\""$0"\""}' > git_tag.inc
./tools/sed/sed.exe -i "s/git_tag.inc/git_tag.ci.inc/g" quard_star_tools.pro
lrelease quard_star_tools.pro
qmake -makefile
mingw32-make
windeployqt.exe ./release/out/quard_star_tools.exe
Rename-Item ./release/out quard_star_tools_w64
Rename-Item ./release gui_tools
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: quard_star_tools_w64
path: |
./quard_star_tools/gui_tools/quard_star_tools_w64
./quard_star_tools/run_quard_star_tools.bat
retention-days: 1
quard_star_tools_macos_build:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.5.3'
modules: 'qt5compat qtwebsockets qtmultimedia'
aqtversion: ==3.1.7
- name: Install prerequisites
run: |
ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2 > /dev/null
brew install --build-from-source upx
- name: Build all
shell: bash -l {0}
run: |
cd quard_star_tools
git describe --always --long --abbrev=10 --exclude '*' | awk '{print "\""$0"\""}' > git_tag.inc
sed -i'.original' -e 's/git_tag.inc/git_tag.ci.inc/g' quard_star_tools.pro
lrelease quard_star_tools.pro
qmake -makefile
make
cd ./release/out
macdeployqt quard_star_tools.app -dmg -verbose=2
cd -
mkdir ./gui_tools
mkdir ./gui_tools/quard_star_tools_macos
mv ./release/out/quard_star_tools.dmg ./gui_tools/quard_star_tools_macos/quard_star_tools.dmg
mv ../.github/workflows/res/installer_background.png ./gui_tools/quard_star_tools_macos/installer_background.png
tar -czf quard_star_tools.tar.gz gui_tools/
- name: Upload build asserts
uses: actions/upload-artifact@v4
with:
name: quard_star_tools_macos
path: |
./quard_star_tools/quard_star_tools.tar.gz
retention-days: 1