-
-
Notifications
You must be signed in to change notification settings - Fork 11
261 lines (249 loc) · 9.5 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
name: CI
on:
push:
branches: [ master ]
tags:
'v*'
pull_request:
branches: [ master ]
env:
QtVersion: 6.6.1
QtKey: "6.6.1"
PackageGLOB: "Black_Chocobo-*.*"
BuildType: Release
cmakeConfigure: "cmake -S. -Bbuild -DQT_DEFAULT_MAJOR_VERSION=6 -DCMAKE_BUILD_TYPE=Release"
debianRequirments: "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 libgl1-mesa-dev rename wget curl devscripts"
jobs:
precheck:
name: Job Info
runs-on: ubuntu-latest
outputs:
version: ${{ steps.checkbuild.outputs.version }}
steps:
- name: Run Info
id: checkbuild
run: |
if [[ "$GITHUB_REF" == *"tags/v"* ]]; then
VER="$GITHUB_REF_NAME"
else
VER="continuous"
fi
echo "version=$VER" >> $GITHUB_OUTPUT
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.debianRequirments}} > /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: |
${{env.cmakeConfigure}} -DCMAKE_INSTALL_PREFIX=/usr -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}}
cmake --build build
cpack -G DEB -C ${{env.BuildType}} --config build/CPackConfig.cmake
- name: Upload
uses: actions/upload-artifact@v4
with:
name: debian-artifacts-${{ matrix.config.name }}
path: blackchocobo*.deb
main_build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
needs: precheck
strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux-amd64"
, os: ubuntu-20.04
, QT_INST_DIR: /opt
, ff7tkPrefix: /opt/ff7tk
, ff7tkPackage: ff7tk-continuous-linux_X86_64.tar.gz
, install_ff7tk: "sudo tar -xf ff7tk-continuous-linux_x86_64.tar.gz --one-top-level=/opt/ff7tk"
, extraCMakeConfig: "-DCMAKE_INSTALL_PREFIX=/usr"
, installBC: ""
}
- {
name: "MacOS"
, os: macos-latest
, QT_INST_DIR: /Users/runner
, ff7tkPrefix: /Users/runner/ff7tk
, ff7tkPackage: ff7tk-continuous-macos.zip
, install_ff7tk: "sudo unzip ff7tk-continuous-macos.zip -d /Users/runner/ff7tk"
, extraCMakeConfig: "-DCMAKE_INSTALL_PREFIX=. -DCMAKE_OSX_ARCHITECTURES=\"arm64;x86_64\""
}
- {
name: "Windows-x64", WIN_ARCH: "x64"
, os: windows-2019
, QT_INST_DIR: "C:/"
, ff7tkPrefix: "C:/ff7tk"
, ff7tkPackage: ff7tk-continuous-win64.7z
, install_ff7tk: "7z x ff7tk-continuous-win64.7z -oC:/ff7tk"
, extraCMakeConfig: "-G Ninja"
}
steps:
- name: Setup env
shell: bash
run: |
echo "BCVersion=${{ needs.precheck.outputs.version }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force
- name: Env Script (Windows)
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
with:
arch: ${{matrix.config.WIN_ARCH}}
- name: Install Qt
uses: jurplel/[email protected]
with:
dir: ${{matrix.config.QT_INST_DIR}}
version: ${{ env.QtVersion }}
modules: qt5compat
cache: true
- name: Get ff7tk redist
run: curl -LJO https://github.com/sithlord48/ff7tk/releases/download/continuous/${{matrix.config.ff7tkPackage}}
- name: Cache ff7tk
id: cache-ff7tk
uses: actions/cache@v4
with:
path: ${{ matrix.config.ff7tkPrefix }}
key: ${{ runner.os }}${{ matrix.config.WIN_ARCH }}-Qt${{env.QtVersion}}-ff7tk-${{ hashFiles( 'ff7tk*') }}
- name: Install ff7tk
if: (steps.cache-ff7tk.outputs.cache-hit != 'true')
run: ${{matrix.config.install_ff7tk}}
- name: Set FF7tk Path
if: runner.os == 'Linux'
run: echo /opt/ff7tk/lib | sudo tee /etc/ld.so.conf.d/ff7tk.conf
- name: Build Black_Chocobo
id: main_build
run: |
cmake -S. -DQT_DEFAULT_MAJOR_VERSION=6 -DCMAKE_BUILD_TYPE=Release -DCPACK_PACKAGE_VERSION="${{env.BCVersion}}" -Dff7tk_DIR=${{matrix.config.ff7tkPrefix}}/lib/cmake/ff7tk ${{matrix.config.extraCMakeConfig}}
cmake --build . --config ${{env.BuildType}} --target package
- name: Build AppImage (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -y > /dev/null
sudo apt-get install -qqq libxkbcommon-x11-0 libxcb-cursor0 > /dev/null
make DESTDIR=appdir install
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"
chmod a+x linuxdeploy*.AppImage
export VERSION="${{env.BCVersion}}"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${{ matrix.config.ff7tkPrefix }}/lib
export PATH=$PATH:/opt/Qt/${{env.QtVersion}}/gcc_64/libexec
mkdir -p ./appdir/usr/share/ff7tk/translations
mkdir -p ./appdir/usr/plugins/iconengines
cp /opt/Qt/${{ env.QtVersion }}/gcc_64/plugins/iconengines/libqsvgicon.so ./appdir/usr/plugins/iconengines/libqsvgicon.so
cp ${{matrix.config.ff7tkPrefix}}/share/ff7tk/translations/*.qm ./appdir/usr/share/ff7tk/translations
./linuxdeploy-x86_64.AppImage --appdir=appdir --output appimage \
-e src/blackchocobo \
-d deploy/io.github.sithlord48.blackchocobo.desktop \
-i deploy/blackchocobo.png \
--plugin=qt
- name: Upload
uses: actions/upload-artifact@v4
with:
name: artifact-${{matrix.config.name}}
path: |
${{github.workspace}}/${{env.PackageGLOB}}
${{github.workspace}}/blackchocobo[-_]*.*
container_build:
# The host should always be linux
runs-on: ubuntu-latest
name: Linux-${{matrix.config.arch}}-${{matrix.config.name}}
needs: precheck
strategy:
fail-fast: false
matrix:
config:
- {
name: "jammy"
, arch: aarch64, distro: ubuntu22.04
, debArch: arm64
}
- {
name: "jammy"
, arch: armv7, distro: ubuntu22.04
, debArch: armhf
}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force
- uses: uraimo/[email protected]
name: Build artifact
with:
arch: ${{ matrix.config.arch }}
distro: ${{ matrix.config.distro }}
githubToken: ${{ github.token }}
setup: mkdir -p "${PWD}/artifacts"
dockerRunArgs: --volume "${PWD}/artifacts:/artifacts"
shell: /bin/sh
install: |
apt-get update -y > /dev/null
apt-get install -qqq ${{env.debianRequirments}} > /dev/null
run: |
curl --retry 5 --retry-max-time 120 -s https://api.github.com/repos/sithlord48/ff7tk/releases/latest | awk -F\" '/browser_download_url.*_${{matrix.config.debArch}}*[.deb]/{print $(NF-1)}' | wget -i -
apt -y -f install ./libff7tk*.deb
rm libff7tk*.deb
git config --global --add safe.directory /home/runner/work/blackchocobo/blackchocobo
${{env.cmakeConfigure}} -DCPACK_PACKAGE_VERSION="${{ needs.precheck.outputs.version }}" -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}}
cmake --build build --config ${{env.BuildType}} --target package
cpack -G DEB -C ${{env.BuildType}} --config build/CPackConfig.cmake
- name: Upload
uses: actions/upload-artifact@v4
with:
name: container-artifact-${{matrix.config.name}}-${{matrix.config.arch}}
path: |
build/Black_Chocobo[-_]*.*
build/blackchocobo[-_]*.*
blackchocobo*.deb
release_assets:
name: Release
needs: [main_build, container_build, deb_builder]
runs-on: ubuntu-latest
steps:
- name: Download Files
uses: actions/download-artifact@v4
- name: Deploy Continuous
if: github.ref == 'refs/heads/master'
uses: crowbarmaster/[email protected]
with:
repo_token: "${{ secrets.DEPLOYTOKEN }}"
automatic_release_tag: "continuous"
prerelease: false
title: "Continuous Build"
files: |
artifact-*/*
container-artifact-*/*
debian-artifacts-*/*
- name: Deploy Release
if: contains(github.ref, 'tags/v')
uses: crowbarmaster/[email protected]
with:
repo_token: "${{ secrets.DEPLOYTOKEN }}"
prerelease: false
files: |
artifact-*/*
container-artifact-*/*
debian-artifacts-*/*