Autogenerate new game folder names #2781
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
# Don't run this workflow when a tag is pushed. | |
branches: | |
- '*' | |
pull_request: | |
env: | |
BOOST_VERSION: 1.87.0 | |
OGDF_VERSION: elderberry-202309 | |
QT_VERSION: 6.9.0 | |
jobs: | |
# Check if the template.pot file is up to date. Run this as a separate job | |
# so that an outdated POT file causes a visible error but does not block the | |
# main CI builds. | |
check-pot: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install gettext | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-upgrade gettext | |
- name: Print xgettext version | |
run: xgettext --version | |
- name: Run pre-commit hook script | |
run: ./scripts/git/hooks/pre-commit | |
- name: Check if any changes were staged | |
run: | | |
if [[ $(git status --porcelain) ]] | |
then | |
echo "::warning ::The generated resources/l10n/template.pot does not match the committed file, which may be outdated and/or was generated by a different version of gettext." | |
git --no-pager diff HEAD | |
fi | |
linux: | |
runs-on: ubuntu-24.04 | |
env: | |
LIBLOOT_VERSION: 0.26.1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: Get Boost metadata | |
id: boost-metadata | |
run: | | |
BOOST_ROOT=~/boost_${BOOST_VERSION//./_} | |
echo "root=$BOOST_ROOT" >> $GITHUB_OUTPUT | |
- name: Set libloot install path | |
run: echo "LIBLOOT_INSTALL_PATH=${{ github.workspace }}/libloot-${{ env.LIBLOOT_VERSION }}-install" >> $GITHUB_ENV | |
- name: Boost cache | |
id: boost-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.boost-metadata.outputs.root }}/boost | |
${{ steps.boost-metadata.outputs.root }}/stage | |
key: ${{ runner.os }}-Boost-${{ env.BOOST_VERSION }} | |
- name: libloot cache | |
id: libloot-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LIBLOOT_INSTALL_PATH }} | |
key: ${{ runner.os }}-libloot-${{ env.LIBLOOT_VERSION }} | |
- name: Install C++ dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-upgrade \ | |
build-essential \ | |
libgl1-mesa-dev \ | |
libicu-dev \ | |
libtbb-dev | |
# The version in apt is too old. | |
- name: Install cbindgen | |
run: | | |
wget https://github.com/mozilla/cbindgen/releases/download/0.28.0/cbindgen | |
BIN_PATH="$HOME/.local/bin/" | |
mkdir -p "$BIN_PATH" | |
mv cbindgen "$BIN_PATH" | |
chmod +x "$BIN_PATH/cbindgen" | |
echo "$BIN_PATH" >> "$GITHUB_PATH" | |
- name: Download & build Boost | |
run: | | |
wget https://raw.githubusercontent.com/Ortham/ci-scripts/2.2.1/install_boost.py | |
python install_boost.py --directory ~ --boost-version $BOOST_VERSION -a 64 locale | |
if: steps.boost-cache.outputs.cache-hit != 'true' | |
- name: Download Qt | |
id: qt-metadata | |
run: | | |
python -m pip install aqtinstall | |
aqt install-qt linux desktop $QT_VERSION linux_gcc_64 | |
echo "root=${{ github.workspace }}/$QT_VERSION/gcc_64" >> $GITHUB_OUTPUT | |
- name: Download and build libloot | |
run: | | |
wget https://github.com/loot/libloot/archive/$LIBLOOT_VERSION.tar.gz | |
tar -xf $LIBLOOT_VERSION.tar.gz | |
LIBLOOT_BUILD_DIR="libloot-$LIBLOOT_VERSION/build" | |
cmake \ | |
-DCMAKE_PREFIX_PATH=${{ steps.boost-metadata.outputs.root }}/stage \ | |
-DLIBLOOT_BUILD_TESTS=OFF \ | |
-DLIBLOOT_INSTALL_DOCS=OFF \ | |
-DCMAKE_INSTALL_PREFIX="$LIBLOOT_INSTALL_PATH" \ | |
-B "$LIBLOOT_BUILD_DIR" \ | |
-S "libloot-$LIBLOOT_VERSION" | |
cmake --build "$LIBLOOT_BUILD_DIR" --target loot --config Release | |
cmake --install "$LIBLOOT_BUILD_DIR" --config Release | |
if: steps.libloot-cache.outputs.cache-hit != 'true' | |
- name: Run CMake | |
run: | | |
cmake \ | |
-DQt6_ROOT="${{ steps.qt-metadata.outputs.root }}" \ | |
-DCMAKE_PREFIX_PATH="${{ env.LIBLOOT_INSTALL_PATH }};${{ steps.boost-metadata.outputs.root }}/stage" \ | |
-B build | |
cmake --build build --target loot_gui_tests | |
- name: Run tests | |
run: ctest --test-dir build --output-on-failure --parallel | |
flatpak: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: flatpak-builder cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/build/.flatpak-builder | |
key: ${{ runner.os }}-flatpak-builder-${{ hashFiles('resources/linux/io.github.loot.loot.yml') }} | |
- name: Get descriptive LOOT version | |
id: get-loot-version | |
shell: bash | |
run: | | |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7) | |
GIT_REF=${{ github.ref }} | |
GIT_REF_SUFFIX=${GIT_REF#refs/*/} | |
LOOT_DESC_REF=${GIT_DESCRIBE}_${GIT_REF_SUFFIX} | |
LOOT_SAFE_DESC_REF=${LOOT_DESC_REF//[\/<>\"|]/_} | |
echo "version=$LOOT_SAFE_DESC_REF" >> $GITHUB_OUTPUT | |
- name: Install Flatpak build dependencies | |
run: | | |
sudo add-apt-repository ppa:flatpak/stable | |
sudo apt-get update | |
sudo apt-get install -y --no-upgrade \ | |
flatpak \ | |
flatpak-builder | |
- name: Generate Flatpak dependency manifests | |
run: ./scripts/generate_manifests.sh | |
- name: Lint the AppStream MetaInfo | |
run: | | |
flatpak install flathub -y org.flatpak.Builder | |
flatpak run --command=flatpak-builder-lint org.flatpak.Builder \ | |
manifest resources/linux/io.github.loot.loot.yml \ | |
--exceptions | |
- name: Build Flatpak package | |
id: build-flatpak | |
run: | | |
PACKAGE_FILENAME=loot_${{ steps.get-loot-version.outputs.version }}.flatpak | |
./scripts/build_flatpak.sh "$PACKAGE_FILENAME" | |
echo "filename=$PACKAGE_FILENAME" >> $GITHUB_OUTPUT | |
- name: Lint the Flatpak package repo | |
run: | | |
flatpak run --command=flatpak-builder-lint org.flatpak.Builder \ | |
repo build/flatpak-repo \ | |
--exceptions \ | |
--user-exceptions resources/linux/flatpak-builder-lint-exceptions.json | |
- name: Import GPG key | |
run: echo -n "${{ secrets.GPG_SIGNING_KEY }}" | gpg --import | |
if: github.event_name == 'push' | |
- name: Sign Flatpak package | |
run: gpg --output "build/${{ steps.build-flatpak.outputs.filename }}.sig" --detach-sig "build/${{ steps.build-flatpak.outputs.filename }}" | |
if: github.event_name == 'push' | |
- name: Upload Flatpak package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build-flatpak.outputs.filename }} | |
path: | | |
build/${{ steps.build-flatpak.outputs.filename }} | |
build/${{ steps.build-flatpak.outputs.filename }}.sig | |
if: github.event_name == 'push' | |
windows: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
- name: Get Boost metadata | |
id: boost-metadata | |
run: | | |
$BOOST_ROOT="${{ github.workspace }}/boost_" + $env:BOOST_VERSION -replace "\.", "_" | |
echo "root=$BOOST_ROOT" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Set OGDF install path | |
shell: bash | |
run: echo "OGDF_INSTALL_PATH=${{ github.workspace }}/ogdf-${{ env.OGDF_VERSION }}-install" >> $GITHUB_ENV | |
- name: Boost cache | |
id: boost-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.boost-metadata.outputs.root }}/boost | |
${{ steps.boost-metadata.outputs.root }}/stage | |
key: ${{ runner.os }}-x64-Boost-${{ env.BOOST_VERSION }} | |
- name: OGDF cache | |
id: ogdf-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.OGDF_INSTALL_PATH }} | |
key: ${{ runner.os }}-x64-ogdf-${{ env.OGDF_VERSION }} | |
- name: Download and extract svg_to_ico | |
run: | | |
curl -sfSLO 'https://github.com/Ortham/svg_to_ico/releases/download/1.1.0/svg_to_ico.7z' | |
7z e -y svg_to_ico.7z | |
- name: Generate ICO file | |
run: .\svg_to_ico.exe -i resources\icons\loot.svg -o build\icon\icon.ico | |
- name: Download & build Boost | |
run: | | |
curl -sSfLO https://raw.githubusercontent.com/Ortham/ci-scripts/2.2.1/install_boost.py | |
python install_boost.py --directory ${{ github.workspace }} --boost-version ${{ env.BOOST_VERSION }} -a 64 locale | |
if: steps.boost-cache.outputs.cache-hit != 'true' | |
- name: Download and build OGDF | |
run: | | |
curl -sSfLO https://github.com/ogdf/ogdf/archive/refs/tags/${env:OGDF_VERSION}.zip | |
Expand-Archive -Path "${env:OGDF_VERSION}.zip" -DestinationPath . | |
$OGDF_BUILD_DIR="ogdf-${env:OGDF_VERSION}/build" | |
git apply -v --directory=ogdf-${env:OGDF_VERSION} cmake/ogdf-chrono.patch | |
cmake -G "Visual Studio 17 2022" ` | |
-A x64 ` | |
-DCMAKE_INSTALL_PREFIX="${env:OGDF_INSTALL_PATH}" ` | |
-B $OGDF_BUILD_DIR ` | |
-S "ogdf-${env:OGDF_VERSION}" | |
cmake --build $OGDF_BUILD_DIR --config Release | |
cmake --install $OGDF_BUILD_DIR --config Release | |
if: steps.ogdf-cache.outputs.cache-hit != 'true' | |
- name: Download Qt | |
id: qt-metadata | |
run: | | |
python -m pip install aqtinstall | |
aqt install-qt windows desktop ${env:QT_VERSION} win64_msvc2022_64 | |
echo "root=${{ github.workspace }}/${env:QT_VERSION}/msvc2022_64" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Run CMake | |
run: | | |
cmake -G "Visual Studio 17 2022" ` | |
-A x64 ` | |
-DCMAKE_PREFIX_PATH="${{ steps.boost-metadata.outputs.root }}\stage" ` | |
-DQt6_ROOT="${{ steps.qt-metadata.outputs.root }}" ` | |
-DOGDF_ROOT="${{ env.OGDF_INSTALL_PATH }}" ` | |
-B build | |
cmake --build build --config Release | |
- name: Run tests | |
run: ctest --test-dir build --output-on-failure --parallel --build-config Release | |
- name: Install packages for building docs | |
run: | | |
python -m pip install -r docs/requirements.txt | |
- name: Build docs | |
run: sphinx-build -b html docs build\docs\html | |
- name: Install Gettext | |
run: | | |
$filename='gettext-tools-windows-0.22.5.zip' | |
curl -sSfLO "https://github.com/vslavik/gettext-tools-windows/releases/download/v0.22.5/$filename" | |
7z x -y -ogettext ".\$filename" | |
echo "$PWD/gettext/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Build translation message object files | |
run: python scripts/po_to_mo.py | |
- name: Get descriptive LOOT version | |
id: get-loot-version | |
shell: bash | |
run: | | |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7) | |
GIT_REF=${{ github.ref }} | |
GIT_REF_SUFFIX=${GIT_REF#refs/*/} | |
LOOT_DESC_REF=${GIT_DESCRIBE}_${GIT_REF_SUFFIX} | |
LOOT_SAFE_DESC_REF=${LOOT_DESC_REF//[\/<>\"|]/_} | |
SAFE_GIT_REF_SUFFIX=${GIT_REF_SUFFIX//[\/<>\"|]/_} | |
echo "version=$LOOT_SAFE_DESC_REF" >> $GITHUB_OUTPUT | |
echo "ref=$SAFE_GIT_REF_SUFFIX" >> $GITHUB_OUTPUT | |
- name: Get LOOT artifact basename | |
id: get-artifact-basename | |
shell: bash | |
run: | | |
VERSION="${{ steps.get-loot-version.outputs.version }}" | |
echo "basename=loot_${VERSION}-win64" >> $GITHUB_OUTPUT | |
- name: Import GPG key | |
run: echo -n "${{ secrets.GPG_SIGNING_KEY }}" | gpg --import | |
if: github.event_name == 'push' | |
- name: Build archive | |
run: | | |
$env:PATH="${{ steps.qt-metadata.outputs.root }}/bin;$env:PATH" | |
python scripts\archive.py . "${{ steps.get-loot-version.outputs.ref }}" | |
mv "build\loot_${{ steps.get-loot-version.outputs.version }}.7z" "build\${{ steps.get-artifact-basename.outputs.basename }}.7z" | |
- name: Sign archive | |
run: gpg --output "build/${{ steps.get-artifact-basename.outputs.basename }}.7z.sig" --detach-sig "build/${{ steps.get-artifact-basename.outputs.basename }}.7z" | |
if: github.event_name == 'push' | |
- name: Build installer | |
run: | | |
scripts\prepare_installer.ps1 | |
$env:PATH += ';C:\Program Files (x86)\Inno Setup 6' | |
iscc scripts\installer.iss | |
mv "build\LOOT Installer.exe" "build\${{ steps.get-artifact-basename.outputs.basename }}.exe" | |
- name: Sign installer | |
run: gpg --output "build/${{ steps.get-artifact-basename.outputs.basename }}.exe.sig" --detach-sig "build/${{ steps.get-artifact-basename.outputs.basename }}.exe" | |
if: github.event_name == 'push' | |
- name: Upload archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.get-artifact-basename.outputs.basename }}.7z | |
path: | | |
build/${{ steps.get-artifact-basename.outputs.basename }}.7z | |
build/${{ steps.get-artifact-basename.outputs.basename }}.7z.sig | |
if: github.event_name == 'push' | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.get-artifact-basename.outputs.basename }}.exe | |
path: | | |
build/${{ steps.get-artifact-basename.outputs.basename }}.exe | |
build/${{ steps.get-artifact-basename.outputs.basename }}.exe.sig | |
if: github.event_name == 'push' |