Skip to content

Commit 9b70bc3

Browse files
OmniTroidclaude
andcommitted
CI: have build.yml call configure.sh instead of duplicating deps work
Each platform job now collapses to: checkout → install Qt → run ./configure.sh → deploy + upload. The inline BASS/discord-rpc/QtApng/ themes downloads and the cmake/ninja invocations are gone — configure.sh already does all of that, and on Windows runs windeployqt too. To make configure.sh usable from CI: - Add BUILD_TYPE= CLI override (replaces the hardcoded Debug default). - find_ninja falls back to ninja on PATH when none is bundled with Qt; GitHub runners have ninja from the system rather than under Qt/Tools. The Linux job keeps its patchelf + tar packaging and AppImage build, since those are deployment artifacts that configure.sh isn't in the business of producing. It also stages the qtapng .so into Qt's plugins dir so appimagetool can pick it up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6f7ac0b commit 9b70bc3

2 files changed

Lines changed: 45 additions & 143 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2-
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
1+
# Build matrix: each platform job installs Qt, runs ./configure.sh (which
2+
# handles deps, qtapng, themes, cmake+ninja, and windeployqt on Windows),
3+
# then deploys + uploads.
34
name: CI Build
45

56
on:
@@ -28,7 +29,7 @@ jobs:
2829
- uses: actions/checkout@master
2930
with:
3031
submodules: recursive
31-
32+
3233
- name: Install Qt
3334
uses: jurplel/install-qt-action@v4
3435
with:
@@ -37,75 +38,20 @@ jobs:
3738
arch: win64_mingw
3839
cache: true
3940
cache-key-prefix: install-qt-action
40-
modules: 'qtimageformats qtwebsockets'
41+
modules: 'qtimageformats qtwebsockets qtmultimedia'
4142

42-
- name: Install Windows Discord RPC
43-
shell: bash
44-
run: |
45-
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-win.zip -o discord_rpc.zip
46-
unzip discord_rpc.zip
47-
cp ./discord-rpc/win64-dynamic/lib/discord-rpc.lib ./lib/
48-
cp ./discord-rpc/win64-dynamic/bin/discord-rpc.dll ./bin/
49-
cp ./discord-rpc/win64-dynamic/include/discord*.h ./lib/
50-
51-
- name: Install Windows BASS
43+
- name: Configure and build
5244
shell: bash
5345
run: |
54-
curl http://www.un4seen.com/files/bass24.zip -o bass.zip
55-
unzip -d bass -o bass.zip
56-
cp ./bass/c/bass.h ./lib
57-
cp ./bass/c/x64/bass.lib ./lib/
58-
cp ./bass/x64/bass.dll ./bin/
59-
60-
curl http://www.un4seen.com/files/bassopus24.zip -o bassopus.zip
61-
unzip -d bass -o bassopus.zip
62-
cp ./bass/c/bassopus.h ./lib
63-
cp ./bass/c/x64/bassopus.lib ./lib/
64-
cp ./bass/x64/bassopus.dll ./bin/
65-
66-
- name: Clone Apng plugin
67-
uses: actions/checkout@master
68-
with:
69-
repository: jurplel/QtApng
70-
path: ./qtapng
71-
72-
- name: Build Apng plugin
73-
run: |
74-
cd ./qtapng
75-
cmake . -G "MinGW Makefiles"
76-
cmake --build . --config Release
77-
mkdir -p ${{ github.workspace }}/bin/imageformats/
78-
cp plugins/imageformats/qapng.dll ${{ github.workspace }}/bin/imageformats/qapng.dll
79-
80-
- name: Build
81-
run: |
82-
cmake . -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=Release
83-
cmake --build . --config Release
84-
85-
- name: Deploy Windows
86-
working-directory: ${{github.workspace}}/bin/
87-
shell: bash
88-
run: |
89-
windeployqt --no-quick-import --no-translations --no-compiler-runtime --no-opengl-sw ./Attorney_Online.exe
90-
91-
- name: Clone Themes
92-
uses: actions/checkout@master
93-
with:
94-
repository: AttorneyOnline/AO2-Themes
95-
path: "bin/base/themes"
96-
97-
- name: Cleanup Themes Checkout
98-
run: |
99-
rm ./bin/base/themes/.gitignore
100-
rm ./bin/base/themes/.gitattributes
101-
Remove-Item -Path "./bin/base/themes/.git" -Recurse -Force
46+
QT_ROOT="$(cd "$QT_ROOT_DIR/../.." && pwd)"
47+
./configure.sh QT_ROOT="$QT_ROOT" QT_PATH="$QT_ROOT_DIR" BUILD_TYPE=Release
10248
10349
- name: Upload Artifact
10450
uses: actions/upload-artifact@master
10551
with:
10652
name: Attorney_Online-Windows
107-
path: ${{github.workspace}}/bin
108-
53+
path: ${{ github.workspace }}/bin
54+
10955
build-linux:
11056
needs: formatting-check
11157
runs-on: ubuntu-22.04
@@ -124,103 +70,52 @@ jobs:
12470
arch: 'gcc_64'
12571
cache: true
12672
cache-key-prefix: install-qt-action
127-
modules: 'qtimageformats qtwebsockets'
128-
129-
- name: Install Linux Discord RPC
130-
run: |
131-
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc.zip
132-
unzip discord_rpc.zip
133-
cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./lib/
134-
cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./bin/
135-
cp ./discord-rpc/linux-dynamic/include/discord*.h ./src/
136-
137-
- name: Install Linux BASS
138-
run: |
139-
curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip
140-
unzip -d bass -o bass.zip
141-
cp ./bass/c/bass.h ./lib
142-
cp ./bass/libs/x86_64/libbass.so ./lib/
143-
cp ./bass/libs/x86_64/libbass.so ./bin/
144-
145-
curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip
146-
unzip -d bass -o bassopus.zip
147-
cp ./bass/c/bassopus.h ./lib
148-
cp ./bass/libs/x86_64/libbassopus.so ./lib/
149-
cp ./bass/libs/x86_64/libbassopus.so ./bin/
150-
151-
- name: Clone Apng plugin
152-
uses: actions/checkout@master
153-
with:
154-
repository: jurplel/QtApng
155-
path: ./qtapng
156-
157-
- name: Build Apng plugin
158-
run: |
159-
cd ./qtapng
160-
cmake . -D CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE="${{ github.workspace }}/bin/imageformats/"
161-
cmake --build . --config Release
73+
modules: 'qtimageformats qtwebsockets qtmultimedia'
16274

163-
# install plugin
164-
cp plugins/imageformats/libqapng.so ${QT_ROOT_DIR}/plugins/imageformats
75+
- name: Install system build tools
76+
run: sudo apt-get update && sudo apt-get install -y ninja-build patchelf libxcb-cursor0
16577

166-
- name: Build
78+
- name: Configure and build
16779
run: |
168-
cmake .
169-
cmake --build . --config Release
170-
171-
- name: Clone Themes
172-
uses: actions/checkout@master
173-
with:
174-
repository: AttorneyOnline/AO2-Themes
175-
path: "bin/base/themes"
80+
QT_ROOT="$(cd "$QT_ROOT_DIR/../.." && pwd)"
81+
./configure.sh QT_ROOT="$QT_ROOT" QT_PATH="$QT_ROOT_DIR" BUILD_TYPE=Release
17682
177-
- name: Cleanup Themes Checkout
83+
- name: Stage APNG plugin for AppImage
17884
run: |
179-
rm ./bin/base/themes/.gitignore
180-
rm ./bin/base/themes/.gitattributes
181-
rm -r ./bin/base/themes/.git
85+
mkdir -p "$QT_ROOT_DIR/plugins/imageformats"
86+
cp qtapng/plugins/imageformats/libqapng.so "$QT_ROOT_DIR/plugins/imageformats/"
18287
183-
- name: Deploy Linux
88+
- name: Package dynamic tarball
18489
shell: bash
18590
run: |
186-
cd ${{ github.workspace }}/bin
187-
mkdir ./imageformats
188-
cp ../qtapng/plugins/imageformats/libqapng.so ./imageformats
91+
cd "${{ github.workspace }}/bin"
18992
cp ../data/logo-client.png ./icon.png
19093
cp ../README_LINUX.md .
19194
cp ../scripts/DYNAMIC_INSTALL.sh ./INSTALL.sh
192-
chmod +x INSTALL.sh
193-
chmod +x Attorney_Online
194-
95+
chmod +x INSTALL.sh Attorney_Online
19596
patchelf --add-rpath . Attorney_Online
196-
19797
cd ..
19898
tar --transform='flags=r;s|bin|Attorney Online|' -cvf Attorney_Online-Dynamic.tar bin
19999
200-
- name: Create AppImage
100+
- name: Build AppImage
201101
shell: bash
202102
run: |
203-
# necessary, apparently
204-
sudo apt install libxcb-cursor0
205103
# from https://github.com/probonopd/go-appimage/blob/master/src/appimagetool/README.md
206104
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
207105
mv appimagetool-*-x86_64.AppImage appimagetool
208106
chmod +x appimagetool
209107
210-
mkdir -p AppDir/usr/bin
211-
mkdir -p AppDir/usr/lib/plugins/imageformats
212-
mkdir -p AppDir/usr/share/applications
213-
108+
mkdir -p AppDir/usr/bin AppDir/usr/lib/plugins/imageformats AppDir/usr/share/applications
214109
cp bin/Attorney_Online AppDir/usr/bin
215-
cp bin/lib*.so AppDir/usr/lib
110+
cp bin/lib*.so AppDir/usr/lib 2>/dev/null || true
216111
cp scripts/Attorney_Online.desktop AppDir/usr/share/applications
217112
cp data/logo-client.png AppDir/Attorney_Online.png
218113
219114
GIT_SHORT_SHA="${GITHUB_SHA::8}"
220-
QTDIR=${QT_ROOT_DIR} ./appimagetool deploy AppDir/usr/share/applications/Attorney_Online.desktop
115+
QTDIR="$QT_ROOT_DIR" ./appimagetool deploy AppDir/usr/share/applications/Attorney_Online.desktop
221116
ARCH=x86_64 VERSION=${GIT_SHORT_SHA} ./appimagetool AppDir
222117
223-
- name: Deploy AppImage
118+
- name: Package AppImage tarball
224119
shell: bash
225120
run: |
226121
mkdir bin-appimage
@@ -229,9 +124,7 @@ jobs:
229124
cp README_LINUX.md bin-appimage
230125
cp scripts/APPIMAGE_INSTALL.sh bin-appimage/INSTALL.sh
231126
cp Attorney_Online-*-x86_64.AppImage bin-appimage
232-
chmod +x bin-appimage/INSTALL.sh
233-
chmod +x bin-appimage/Attorney_Online-*-x86_64.AppImage
234-
127+
chmod +x bin-appimage/INSTALL.sh bin-appimage/Attorney_Online-*-x86_64.AppImage
235128
tar --transform='flags=r;s|bin-appimage|Attorney Online|' -cvf Attorney_Online-AppImage.tar bin-appimage
236129
237130
- name: Upload Dynamic Artifact

configure.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ print_help() {
3737
echo " clean: Remove all files from lib, bin and tmp"
3838
echo " QT_ROOT=path: Specify the root path to where Qt is installed (eg. /c/Qt/)"
3939
echo " QT_PATH=path: Specify the exact Qt install to use, bypassing auto-detection (eg. /c/Qt/6.5.3/mingw_64)"
40+
echo " BUILD_TYPE=Debug|Release: CMake build type (default: Debug)"
4041
}
4142

4243
# Check if a given command returns a non-zero exit code
@@ -168,18 +169,25 @@ find_mingw() {
168169
}
169170

170171
find_ninja() {
171-
# Find a ninja installation bundled with Qt
172-
QT_TOOLS_PATH="${QT_ROOT}/Tools"
173-
174-
local ninja_path=""
175-
172+
# Prefer the ninja bundled with Qt, fall back to ninja on PATH.
173+
local bundled=""
176174
if [[ "$PLATFORM" == "windows" ]]; then
177-
ninja_path="${QT_TOOLS_PATH}/Ninja/ninja.exe"
175+
bundled="${QT_ROOT}/Tools/Ninja/ninja.exe"
178176
else
179-
ninja_path="${QT_TOOLS_PATH}/Ninja/ninja"
177+
bundled="${QT_ROOT}/Tools/Ninja/ninja"
178+
fi
179+
180+
if [[ -f "$bundled" ]]; then
181+
echo "$bundled"
182+
return 0
183+
fi
184+
185+
if command -v ninja >/dev/null 2>&1; then
186+
echo "ninja"
187+
return 0
180188
fi
181189

182-
echo "$ninja_path"
190+
echo ""
183191
}
184192

185193
get_zip() {
@@ -376,6 +384,7 @@ configure() {
376384
case "$1" in
377385
QT_ROOT=*) QT_ROOT="${1#*=}" ;;
378386
QT_PATH=*) QT_PATH="${1#*=}" ;;
387+
BUILD_TYPE=*) BUILD_CONFIG="${1#*=}" ;;
379388
*) echo "Unknown argument: $1"; print_help; exit 1 ;;
380389
esac
381390
shift

0 commit comments

Comments
 (0)