Skip to content

ci: use Qt install action v4 #471

ci: use Qt install action v4

ci: use Qt install action v4 #471

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
tags:
'v*'
pull_request:
branches: [ master ]
env:
QtVersion: 6.6.3
QtKey: "6.6.3"
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/install-qt-action@v4
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') && !(contains(github.ref, '/tags/v'))
uses: crowbarmaster/GH-Automatic-Releases@latest
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/GH-Automatic-Releases@latest
with:
repo_token: "${{ secrets.DEPLOYTOKEN }}"
prerelease: false
files: |
artifact-*/*
container-artifact-*/*
debian-artifacts-*/*