-
Notifications
You must be signed in to change notification settings - Fork 15
219 lines (194 loc) · 8.33 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
name: CI/CD
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]
create: null
jobs:
main_build:
name: ${{ matrix.package_suffix }} ${{ matrix.interface }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
qt:
- 6.6.3
os:
- ubuntu-latest
- macos-latest
- windows-latest
interface:
- cli
- gui
build_type:
- Release
include:
- qt_tools: tools_ninja
qt_modules:
cmake_cli_arg: 'OFF'
- os: ubuntu-latest
package_extension: 'tar.xz'
package_suffix: 'linux64'
- os: macos-latest
package_extension: 'dmg'
package_suffix: 'macos'
cmake_extra_args: "-DCMAKE_OSX_ARCHITECTURES=\"arm64;x86_64\""
- os: windows-latest
package_extension: 'zip'
package_suffix: 'win64'
win_arch: "x64"
qt_arch: win64_msvc2019_64
cmake_extra_args: '-DZLIB_ROOT=C:/zlib'
qt_tools: tools_ninja, tools_cmake
- interface: gui
cmake_cli_arg: 'OFF'
cmake_gui_arg: 'ON'
- interface: cli
cmake_cli_arg: 'ON'
cmake_gui_arg: 'OFF'
env:
qt_installation_path: ${{ github.workspace }}
zlib_path: ${{ github.workspace }}/../zlib-git
zlib_build_path: ${{ github.workspace }}/../build-zlib-git
zlib_installation_path: C:/zlib
zlib_version: "1.3.1"
lz4_path: ${{ github.workspace }}/../lz4-git
lz4_build_path: ${{ github.workspace }}/../build-lz4-git
lz4_installation_path: ${{ github.workspace }}/../lz4
lz4_version: "dev"
deling_build_path: ${{ github.workspace }}/../build-deling
deling_installation_path: ${{ github.workspace }}/../installation-deling
deling_appbundle_path: ${{ github.workspace }}/../appbundle-deling
CMAKE_GENERATOR: Ninja
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
steps:
- uses: actions/checkout@v4
- name: Env Script (Windows)
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
arch: ${{ matrix.win_arch }}
- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
with:
dir: ${{ env.qt_installation_path }}
arch: ${{ matrix.qt_arch }}
version: ${{ matrix.qt }}
cache: true
tools: ${{ matrix.qt_tools }}
modules: ${{ matrix.qt_modules }}
- name: Configure env
shell: bash
run: |
QT_MAJOR_VERSION=$(echo "${{ matrix.qt }}" | sed -E 's/^([0-9]+)\..*/\1/')
QT_DIR=$(eval 'echo $Qt'"$QT_MAJOR_VERSION"'_DIR')
echo "$IQTA_TOOLS/Ninja" >> $GITHUB_PATH
echo "$IQTA_TOOLS/CMake_64/bin" >> $GITHUB_PATH
echo "QT_MAJOR_VERSION=$QT_MAJOR_VERSION" >> $GITHUB_ENV
echo "QT_DIR=$QT_DIR" >> $GITHUB_ENV
- name: Set prerelease string
if: github.event.ref_type != 'tag'
shell: bash
run: |
echo "PRERELEASE_STRING= unstable build" >> $GITHUB_ENV
- name: Cache Zlib
id: cache-zlib
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: ${{ env.zlib_installation_path }}
key: ${{ runner.os }}${{ matrix.win_arch }}-zlib-${{ env.zlib_version}}
- name: Install Zlib
if: (runner.os == 'Windows') && (steps.cache-zlib.outputs.cache-hit != 'true')
run: |
git clone -q --depth 1 --single-branch --branch=v${{ env.zlib_version }} https://github.com/madler/zlib ${{ env.zlib_path }}
cmake -S${{ env.zlib_path }} -B${{ env.zlib_build_path }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ env.zlib_installation_path }}
cmake --build ${{ env.zlib_build_path }} --target install -j3
- name: Cache lz4
id: cache-lz4
uses: actions/cache@v4
with:
path: ${{ env.lz4_installation_path }}
key: ${{ runner.os }}${{ matrix.win_arch }}-lz4-${{ env.lz4_version}}
- name: Install lz4
if: steps.cache-lz4.outputs.cache-hit != 'true'
run: |
git clone -q --depth 1 --single-branch --branch=${{ env.lz4_version }} https://github.com/lz4/lz4 ${{ env.lz4_path }}
cmake -S${{ env.lz4_path }}/build/cmake -B${{ env.lz4_build_path }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ env.lz4_installation_path }} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON -DLZ4_BUILD_LEGACY_LZ4C:BOOL=OFF -DLZ4_POSITION_INDEPENDENT_LIB:BOOL=OFF -DLZ4_BUILD_CLI:BOOL=OFF ${{ matrix.cmake_extra_args }}
cmake --build ${{ env.lz4_build_path }} --target install -j3
- name: Download linuxdeployqt
if: runner.os == 'Linux'
run: |
wget -qc "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget -qc "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
export VERSION=continuous
chmod a+x linuxdeploy*.AppImage
mv linuxdeploy-plugin-qt-*.AppImage $QT_DIR/bin/linuxdeploy-plugin-qt
mv linuxdeploy-*.AppImage $QT_DIR/bin/linuxdeploy
- name: Build Deling
id: main_build
run: |
cmake -B ${{ env.deling_build_path }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ env.deling_installation_path }} -DCLI:BOOL=${{ matrix.cmake_cli_arg }} -DGUI:BOOL=${{ matrix.cmake_gui_arg }} -DPRERELEASE_STRING="$PRERELEASE_STRING" -Dlz4_DIR=${{ env.lz4_installation_path }}/lib/cmake/lz4 ${{ matrix.cmake_extra_args }}
cmake --build ${{ env.deling_build_path }} --target package -j3
- name: Build AppImage (Linux)
if: runner.os == 'Linux' && matrix.interface == 'gui'
run: |
sudo add-apt-repository -y universe
sudo apt install -y libfuse2 libxkbcommon-x11-0 libxcb-cursor0
cmake --build ${{ env.deling_build_path }} --target install -j3
mkdir -p ${{env.deling_appbundle_path}}/usr/share/deling/translations
cp ${{env.deling_installation_path}}/share/deling/translations/*.qm ${{env.deling_appbundle_path}}/usr/share/deling/translations/
export VERSION=continuous
export PATH=$PATH:${{ env.qt_installation_path }}/Qt/${{ matrix.qt }}/gcc_64/libexec
linuxdeploy --appdir="${{ env.deling_appbundle_path }}" --plugin=qt --output appimage \
-e "${{ env.deling_installation_path }}"/bin/Deling \
-d "${{ env.deling_installation_path }}"/share/applications/io.github.myst6re.deling.desktop \
-i "${{ env.deling_installation_path }}"/share/icons/hicolor/256x256/apps/io.github.myst6re.deling.png
mv *.AppImage deling-continuous-${{ matrix.interface }}-${{ matrix.package_suffix }}.AppImage
- name: Prepare Upload
shell: bash
run: mv ../build-deling/*.${{ matrix.package_extension }} deling-continuous-${{ matrix.interface }}-${{ matrix.package_suffix }}.${{ matrix.package_extension }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.package_suffix }}-${{ matrix.interface }}
path: ${{ github.workspace }}/deling-continuous-*.*
pre_release_assets:
name: Pre-Release
needs: [main_build]
if: (github.event.ref_type != 'tag') && (github.ref == 'refs/heads/develop')
concurrency: pre-release-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Download Files
uses: actions/download-artifact@v4
- name: Deploy Package
uses: crowbarmaster/GH-Automatic-Releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "continuous"
prerelease: true
title: "Unstable Build"
files: |
artifact-*/*
release_assets:
name: Release
needs: [main_build]
if: github.event.ref_type == 'tag'
concurrency: release-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Download Files
uses: actions/download-artifact@v4
- name: Prepare Upload
shell: bash
run: find . -type f -name 'deling-continuous-*' -exec bash -c 'mv "{}" $(echo {} | sed 's/continuous-//')' ';'
- name: Deploy Package
uses: crowbarmaster/GH-Automatic-Releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: ${{ github.event.ref }}
files: |
artifact-*/*