atrooney-online-2/.github/workflows/build.yml
lambdcalculus ef1a8ddb92
More Linux integration (#1085)
* Add integration shell scripts for linux!

These shell scripts (one for appimage and one for dynamic) both should:
1: Move the program files to ~/.local/Attorney_Online
2: Create a .desktop file (which is what applications on Linux use to know to be interacted with) in the ~/.local/share/applications folder (where all other user applications tend to go), with at current a temporary logo until the logo file is parsed out from the xapplication window.
3: open the application, assuming the necessary dependencies are fulfilled
Dynamic required some further support due to the startup shell command working correctly when you click it manually, but struggling on the .desktop folder, so it has the additional step of recreating the current launch.sh command, which still functions if you go to the folder to click it, or if you open the program before integration to test things.

Both sh commands open AO2-Client at completion time. I hope this will help newer Linux users, or older Linux users who normally wouldn't bother, to bring AO into their normal day to day experience.

This has been tested on (by me):
Fedora 40 Workstation (Gnome)
Arch Linux KDE Plasma 6
Ubuntu Unity 24.10 aka Oracular Oriole
Debian 13 Trixie (Before it's freeze, marking date February 9th 2025)

Thank you for reading, have a wonderful day!

* linux CI tweaks

* remove the need for `launch.sh`
* add git hash as appimage version
* bit of reorganization

* add linux install scripts to CI

* tweak linux install scripts to add install scripts
* remove `launch.sh` (as per previous commit)
* add instructions in README_LINUX

* include icon in linux install

* fix install script

and fix typo

* add exec path to desktop files

* why would freedesktop.org do this to me

---------

Co-authored-by: OrioleNix <163466443+OrioleNix@users.noreply.github.com>
2025-03-17 10:32:11 +01:00

249 lines
8.3 KiB
YAML

# 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.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CI Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
formatting-check:
name: formatting-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C++
uses: jidicula/clang-format-action@v4.12.0
with:
clang-format-version: '17'
check-path: 'src'
fallback-style: LLVM
build-windows:
needs: formatting-check
runs-on: windows-latest
steps:
- uses: actions/checkout@master
with:
submodules: recursive
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.3
target: desktop
arch: win64_msvc2019_64
cache: true
cache-key-prefix: install-qt-action
modules: 'qtimageformats qtwebsockets'
- name: Configure MSVC (Windows)
uses: ilammy/msvc-dev-cmd@v1
- name: Install Windows Discord RPC
shell: bash
run: |
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-win.zip -o discord_rpc.zip
unzip discord_rpc.zip
cp ./discord-rpc/win64-dynamic/lib/discord-rpc.lib ./lib/
cp ./discord-rpc/win64-dynamic/bin/discord-rpc.dll ./bin/
cp ./discord-rpc/win64-dynamic/include/discord*.h ./lib/
- name: Install Windows BASS
shell: bash
run: |
curl http://www.un4seen.com/files/bass24.zip -o bass.zip
unzip -d bass -o bass.zip
cp ./bass/c/bass.h ./lib
cp ./bass/c/x64/bass.lib ./lib/
cp ./bass/x64/bass.dll ./bin/
curl http://www.un4seen.com/files/bassopus24.zip -o bassopus.zip
unzip -d bass -o bassopus.zip
cp ./bass/c/bassopus.h ./lib
cp ./bass/c/x64/bassopus.lib ./lib/
cp ./bass/x64/bassopus.dll ./bin/
- name: Clone Apng plugin
uses: actions/checkout@master
with:
repository: jurplel/QtApng
path: ./qtapng
- name: Build Apng plugin
run: |
cd ./qtapng
cmake . -D CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE="${{ github.workspace }}/bin/imageformats/"
cmake --build . --config Release
- name: Build
run: |
cmake . -D CMAKE_BUILD_TYPE=Release
cmake --build . --config Release
- name: Deploy Windows
working-directory: ${{github.workspace}}/bin/
shell: bash
run: |
windeployqt --no-quick-import --no-translations --no-compiler-runtime --no-opengl-sw ./Attorney_Online.exe
- name: Clone Themes
uses: actions/checkout@master
with:
repository: AttorneyOnline/AO2-Themes
path: "bin/base/themes"
- name: Cleanup Themes Checkout
run: |
rm ./bin/base/themes/.gitignore
rm ./bin/base/themes/.gitattributes
Remove-Item -Path "./bin/base/themes/.git" -Recurse -Force
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
name: Attorney_Online-Windows
path: ${{github.workspace}}/bin
build-linux:
needs: formatting-check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
with:
submodules: recursive
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: '6.5.3'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
cache: true
cache-key-prefix: install-qt-action
modules: 'qtimageformats qtwebsockets'
- name: Install Linux Discord RPC
run: |
curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc.zip
unzip discord_rpc.zip
cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./lib/
cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./bin/
cp ./discord-rpc/linux-dynamic/include/discord*.h ./src/
- name: Install Linux BASS
run: |
curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip
unzip -d bass -o bass.zip
cp ./bass/bass.h ./lib
cp ./bass/libs/x86_64/libbass.so ./lib/
cp ./bass/libs/x86_64/libbass.so ./bin/
curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip
unzip -d bass -o bassopus.zip
cp ./bass/bassopus.h ./lib
cp ./bass/libs/x86_64/libbassopus.so ./lib/
cp ./bass/libs/x86_64/libbassopus.so ./bin/
- name: Clone Apng plugin
uses: actions/checkout@master
with:
repository: jurplel/QtApng
path: ./qtapng
- name: Build Apng plugin
run: |
cd ./qtapng
cmake . -D CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE="${{ github.workspace }}/bin/imageformats/"
cmake --build . --config Release
# install plugin
cp plugins/imageformats/libqapng.so ${QT_ROOT_DIR}/plugins/imageformats
- name: Build
run: |
cmake .
cmake --build . --config Release
- name: Clone Themes
uses: actions/checkout@master
with:
repository: AttorneyOnline/AO2-Themes
path: "bin/base/themes"
- name: Cleanup Themes Checkout
run: |
rm ./bin/base/themes/.gitignore
rm ./bin/base/themes/.gitattributes
rm -r ./bin/base/themes/.git
- name: Deploy Linux
shell: bash
run: |
cd ${{ github.workspace }}/bin
mkdir ./imageformats
cp ../qtapng/plugins/imageformats/libqapng.so ./imageformats
cp ../data/logo-client.png ./icon.png
cp ../README_LINUX.md .
cp ../scripts/DYNAMIC_INSTALL.sh ./INSTALL.sh
chmod +x INSTALL.sh
chmod +x Attorney_Online
patchelf --add-rpath . Attorney_Online
cd ..
tar --transform='flags=r;s|bin|Attorney Online|' -cvf Attorney_Online-Dynamic.tar bin
- name: Create AppImage
shell: bash
run: |
# necessary, apparently
sudo apt install libxcb-cursor0
# from https://github.com/probonopd/go-appimage/blob/master/src/appimagetool/README.md
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)
mv appimagetool-*-x86_64.AppImage appimagetool
chmod +x appimagetool
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/lib/plugins/imageformats
mkdir -p AppDir/usr/share/applications
cp bin/Attorney_Online AppDir/usr/bin
cp bin/lib*.so AppDir/usr/lib
cp scripts/Attorney_Online.desktop AppDir/usr/share/applications
cp data/logo-client.png AppDir/Attorney_Online.png
GIT_SHORT_SHA="${GITHUB_SHA::8}"
QTDIR=${QT_ROOT_DIR} ./appimagetool deploy AppDir/usr/share/applications/Attorney_Online.desktop
ARCH=x86_64 VERSION=${GIT_SHORT_SHA} ./appimagetool AppDir
- name: Deploy AppImage
shell: bash
run: |
mkdir bin-appimage
cp -r bin/base bin-appimage
cp data/logo-client.png bin-appimage/icon.png
cp README_LINUX.md bin-appimage
cp scripts/APPIMAGE_INSTALL.sh bin-appimage/INSTALL.sh
cp Attorney_Online-*-x86_64.AppImage bin-appimage
chmod +x bin-appimage/INSTALL.sh
chmod +x bin-appimage/Attorney_Online-*-x86_64.AppImage
tar --transform='flags=r;s|bin-appimage|Attorney Online|' -cvf Attorney_Online-AppImage.tar bin-appimage
- name: Upload Dynamic Artifact
uses: actions/upload-artifact@master
with:
name: Attorney_Online-Linux-Dynamic
path: Attorney_Online-Dynamic.tar
- name: Upload AppImage Artifact
uses: actions/upload-artifact@master
with:
name: Attorney_Online-Linux-AppImage
path: Attorney_Online-AppImage.tar