-
Notifications
You must be signed in to change notification settings - Fork 11
260 lines (234 loc) · 10.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
name: CI/CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
create: null
env:
debianRequirements: "build-essential git zlib1g-dev cmake qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools qt6-declarative-dev qt6-base-dev libqt6svg6-dev qt6-base-dev-tools qt6-translations-l10n libqt6core5compat6-dev libqt6opengl6-dev libgl1-mesa-dev wget curl devscripts"
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: qt5compat
cmake_cli_arg: 'OFF'
- os: ubuntu-latest
package_extension: 'tar.xz'
package_suffix: 'linux64'
ff7tk_pack_suffix: "linux_x86_64.tar.gz"
ff7tk_install_command_extract: "tar -xf"
ff7tk_install_command_dest: "--one-top-level="
- os: macos-latest
package_extension: 'dmg'
package_suffix: 'macos'
ff7tk_pack_suffix: "macos.zip"
ff7tk_install_command_extract: "unzip "
ff7tk_install_command_dest: "-d "
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
ff7tk_pack_suffix: "win64.7z"
ff7tk_install_command_extract: "7z x"
ff7tk_install_command_dest: "-o"
- 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"
ff7tk_installation_path: ${{ github.workspace }}/ff7tk
makoureactor_build_path: ${{ github.workspace }}/../build-makoureactor
makoureactor_installation_path: ${{ github.workspace }}/../installation-makoureactor
makoureactor_appbundle_path: ${{ github.workspace }}/../appbundle-makoureactor
CMAKE_GENERATOR: Ninja
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
ff7tk_package: ff7tk-continuous-${{matrix.ff7tk_pack_suffix}}
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/[email protected]
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: Get ff7tk redist
run: curl -LJO https://github.com/sithlord48/ff7tk/releases/download/continuous/${{ env.ff7tk_package }}
- name: Install ff7tk
run: ${{matrix.ff7tk_install_command_extract}} ${{env.ff7tk_package}} ${{matrix.ff7tk_install_command_dest}}${{env.ff7tk_installation_path}}
- 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 Makou Reactor
id: main_build
run: |
cmake -B ${{ env.makoureactor_build_path }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ env.makoureactor_installation_path }} -Dff7tk_DIR=${{ env.ff7tk_installation_path }}/lib/cmake/ff7tk -DCLI:BOOL=${{ matrix.cmake_cli_arg }} -DGUI:BOOL=${{ matrix.cmake_gui_arg }} -DPRERELEASE_STRING="$PRERELEASE_STRING" ${{ matrix.cmake_extra_args }}
cmake --build ${{ env.makoureactor_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.makoureactor_build_path }} --target install -j3
DESTDIR=${{${{env.makoureactor_appbundle_path}}}} cmake --build --target install
mkdir -p ${{env.makoureactor_appbundle_path}}/usr/share/ff7tk/translations
cp ${{env.ff7tk_installation_path}}/share/ff7tk/translations/*.qm ${{env.makoureactor_appbundle_path}}/usr/share/ff7tk/translations
mkdir -p ${{env.makoureactor_appbundle_path}}/usr/plugins/iconengines
cp ${{ env.qt_installation_path }}/Qt/${{ matrix.qt }}/gcc_64/plugins/iconengines/libqsvgicon.so ${{env.makoureactor_appbundle_path}}/usr/plugins/iconengines/libqsvgicon.so
export VERSION=continuous
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.ff7tk_installation_path }}/lib
export PATH=$PATH:${{ env.qt_installation_path }}/Qt/${{ matrix.qt }}/gcc_64/libexec
linuxdeploy --appdir="${{ env.makoureactor_appbundle_path }}" --plugin=qt --output appimage \
-e "${{ env.makoureactor_installation_path }}"/bin/Makou_Reactor \
-d "${{ env.makoureactor_installation_path }}"/share/applications/io.github.myst6re.makoureactor.desktop \
-i "${{ env.makoureactor_installation_path }}"/share/icons/hicolor/256x256/apps/io.github.myst6re.makoureactor.png
mv *.AppImage makoureactor-continuous-${{ matrix.interface }}-${{ matrix.package_suffix }}.AppImage
- name: Prepare Upload
shell: bash
run: mv ../build-makoureactor/*.${{ matrix.package_extension }} makoureactor-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 }}/makoureactor-continuous-*.*
deb_builder:
name: debianBuilder-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
fail-fast: false
matrix:
config:
- {
name: jammy , os: ubuntu-22.04
, debArch: amd64
}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force
- name: Install Dependencies
run: |
sudo apt-get update -y > /dev/null
sudo apt-get install -qqq ${{env.debianRequirements}} > /dev/null
curl -s https://api.github.com/repos/sithlord48/ff7tk/releases/latest | awk -F\" '/browser_download_url.*${{matrix.config.debArch}}*[.deb]/{print $(NF-1)}' | wget -i -
sudo apt -y -qqq install ./libff7tk*.deb
rm libff7tk*.deb
- name: Build
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DQT_DEFAULT_MAJOR_VERSION=6 -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}}
cmake --build build
cpack -G DEB -C Release --config build/CPackConfig.cmake
- name: Upload
uses: actions/upload-artifact@v4
with:
name: debian-artifacts-${{ matrix.config.name }}}
path: makoureactor*.deb
pre_release_assets:
name: Pre-Release
needs: [main_build, deb_builder]
if: (github.event.ref_type != 'tag') && (github.ref == 'refs/heads/master')
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-*/*
debian-artifacts-*/*
release_assets:
name: Release
needs: [main_build, deb_builder]
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 'makoureactor-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-*/*
debian-artifacts-*/*