-
Notifications
You must be signed in to change notification settings - Fork 3
234 lines (205 loc) · 8.1 KB
/
build_and_deploy.yaml
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
name: Build and Deploy
on:
push:
paths:
- "src/**"
- "!**.qml"
- "!**.md"
- "!**.cmake"
pull_request:
paths:
- "src/**"
- "!**.qml"
- "!**.md"
- "!**.cmake"
permissions: write-all
env:
BUILD_TYPE: Release
QT_VERSION: "6.5.3"
QT_MODULES: "qt5compat qtwebsockets qthttpserver qtshadertools"
TARGET: SAST_Evento_Desktop
targetName: SAST_Evento_Desktop.exe
fileName: SAST_Evento
jobs:
deploy-ubuntu:
name: Ubuntu
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@v1.1
with:
version: "1.11.1"
# https://github.com/zhuzichu520/FluentUI/blob/06c9b4e3829af636234a98f946603d68c23f6459/.github/workflows/ubuntu.yml#L49-L50
- name: Install GL library (Ubuntu)
run: sudo apt-get install -y libxcb-cursor0 libgl1-mesa-dev libxcb1-dev libgtk-3-dev libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{env.QT_VERSION}}
modules: ${{env.QT_MODULES}}
cache: "true"
cache-key-prefix: "install-qt-action"
- name: Install Fcitx5 for Qt
run: |
sudo apt-get install -y extra-cmake-modules
git clone --depth 1 --branch 5.1.1 https://github.com/fcitx/fcitx5-qt
cmake -DBUILD_ONLY_PLUGIN=ON -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=ON -G Ninja -S ./fcitx5-qt -B ./fcitx5-qt-build -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} -DCMAKE_BUILD_TYPE=Release
cmake --build ./fcitx5-qt-build --parallel --config Release
cmake --install ./fcitx5-qt-build
- name: Configure CMake
run: cmake -G Ninja -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Install Qt Linux Deploy
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage
- name: Package
if: startsWith(github.event.ref, 'refs/tags/')
env:
EXTRA_QT_PLUGINS: qt5compat
run: |
export QML_SOURCES_PATHS=./
echo "[Desktop Entry]" > SAST_Evento.desktop
echo "Categories=Utility;" >> SAST_Evento.desktop
echo "Icon=app_icon" >> SAST_Evento.desktop
echo "Name=SAST Evento" >> SAST_Evento.desktop
echo "Type=Application" >> SAST_Evento.desktop
echo "Exec=SAST_Evento_Desktop" >> SAST_Evento.desktop
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --desktop-file=SAST_Evento.desktop --icon-file=app_icon.svg --executable=bin/release/SAST_Evento_Desktop --appdir AppDir
mv ${{ env.fileName }}-*.AppImage ${{ env.TARGET }}.AppImage
- uses: actions/upload-artifact@v2
if: startsWith(github.event.ref, 'refs/tags/')
with:
name: SAST_Evento_AppImage
path: ${{ env.TARGET }}.AppImage
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.TARGET }}.AppImage
asset_name: ${{ env.fileName }}_AppImage.AppImage
tag: ${{ github.ref }}
overwrite: true
deploy-macos:
name: MacOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13]
qt_ver: [6.5.3]
qt_arch: [clang_64]
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
with:
version: 1.10.2
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{env.QT_VERSION}}
modules: ${{env.QT_MODULES}}
cache: "true"
cache-key-prefix: "install-qt-action"
- name: build macos
run: |
cmake --version
mkdir build
cd build
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=/Users/runner/work/FluentUI/Qt/6.5.3/macos -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
cmake --build . --target all --config Release --parallel
- name: Package
if: startsWith(github.event.ref, 'refs/tags/')
run: |
macdeployqt bin/release/SAST_Evento_Desktop.app -qmldir=. -verbose=1 -dmg
- uses: actions/upload-artifact@v2
if: startsWith(github.event.ref, 'refs/tags/')
with:
name: SAST_Evento_MacOS
path: bin/release/${{ env.TARGET }}.app
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/release/${{ env.TARGET }}.dmg
asset_name: ${{ env.fileName }}_MacOS.dmg
tag: ${{ github.ref }}
overwrite: true
deploy-windows:
name: Windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
include:
- qt_ver: 6.5.3
qt_arch: win64_msvc2019_64
msvc_arch: x64
qt_arch_install: msvc2019_64
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cache: ${{steps.cache-qt.outputs.cache-hit}}
modules: ${{env.QT_MODULES}}
- name: msvc-build
id: build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
ninja --version
mkdir build
cd build
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=D:\a\FluentUI\Qt\6.5.3\msvc2019_64 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -GNinja ..
cmake --build . --target all --config Release --parallel
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
- name: package
if: startsWith(github.event.ref, 'refs/tags/')
id: package
env:
archiveName: ${{ env.fileName }}-${{ matrix.qt_arch }}-${{ matrix.qt_ver }}
msvcArch: ${{ matrix.msvc_arch }}
shell: pwsh
run: |
& scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
# 记录packageName给后续step
$name = ${env:archiveName}
echo "::set-output name=packageName::$name"
- uses: actions/upload-artifact@v2
if: startsWith(github.event.ref, 'refs/tags/')
with:
name: ${{ steps.package.outputs.packageName }}
path: dist
- name: inno setup install
if: startsWith(github.event.ref, 'refs/tags/')
uses: zhuzichu520/inno-setup-action@v1.0.1
with:
filepath: ./action-cli/InstallerScript.iss
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./action-cli/installer.exe
asset_name: ${{ env.fileName }}_win64.exe
tag: ${{ github.ref }}
overwrite: true