Skip to content

Linux installer

Linux installer #49

Workflow file for this run

# Builds the game for multiple platforms and uploads the artifacts
name: Build on multiple platforms
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build_linux:
name: Build for Linux for x86, x64, ARM, ARM64 and PPC64LE
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: ./build-linux.sh
- name: Upload Linux 386 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Linux-386
path: dist/linux_386/kens-labyrinth-linux-386.tar.gz
if-no-files-found: error
- name: Upload Linux AMD64 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Linux-AMD64
path: dist/linux_amd64/kens-labyrinth-linux-amd64.tar.gz
if-no-files-found: error
- name: Upload Linux ARMv7 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Linux-ARMv7
path: dist/linux_arm_v7/kens-labyrinth-linux-armv7.tar.gz
if-no-files-found: error
- name: Upload Linux ARM64 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Linux-ARM64
path: dist/linux_arm64/kens-labyrinth-linux-arm64.tar.gz
if-no-files-found: error
- name: Upload Linux PPC64LE artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Linux-PPC64LE
path: dist/linux_ppc64le/kens-labyrinth-linux-ppc64le.tar.gz
if-no-files-found: error
build_linux_deb:
name: Build Debian packages for Linux
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU for cross-compilation
if: matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libsdl2-dev libsdl2-image-dev libgl1-mesa-dev libglu1-mesa-dev imagemagick
- name: Set up cross-compilation for ARM64
if: matrix.arch == 'arm64'
run: |
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu pkg-config-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
sudo apt-get install -y libsdl2-dev:arm64 libsdl2-image-dev:arm64 libgl1-mesa-dev:arm64 libglu1-mesa-dev:arm64
- name: Build and create .deb package
run: |
mkdir -p build
cd build
if [ "${{ matrix.arch }}" = "arm64" ]; then
cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DPKG_CONFIG_EXECUTABLE=/usr/bin/aarch64-linux-gnu-pkg-config ..
else
cmake ..
fi
make -j$(nproc)
cpack -G DEB
ls -la *.deb
- name: Upload .deb package artifact
uses: actions/upload-artifact@v4
with:
name: lab3d-sdl-deb-${{ matrix.arch }}
path: build/*.deb
if-no-files-found: error
build_nintendo_switch:
name: Build for Nintendo Switch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: ./build-switch.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Nintendo-Switch
path: dist/switch/ken
if-no-files-found: error
build_macos:
name: Build for macOS for Intel and Apple Silicon
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install the Apple developer certificate
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Cache Dependencies
id: cache-dependencies
uses: actions/cache@v4
with:
path: macports-cache
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/CMakeLists.txt') }}
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
brew uninstall cmake
mkdir -p macports-cache
cd macports-cache
git clone https://github.com/macports/macports-base.git
cd macports-base
./configure --prefix=${{ github.workspace }}/macports-cache --enable-readline
make
sudo make install
make distclean
sudo ${{ github.workspace }}/macports-cache/bin/port selfupdate
sudo ${{ github.workspace }}/macports-cache/bin/port install cmake
echo "macosx_deployment_target 12.4" | sudo tee -a ${{ github.workspace }}/macports-cache/etc/macports/macports.conf > /dev/null
# For some reason, the following command fails if you include libsdl2 in the list with "Error: Unable to execute port libsdl2: libiconv does not have a subport 'libsdl2'"
# It's not a problem because libsdl2 is already a dependency of libsdl2_image so it will be installed anyway
sudo ${{ github.workspace }}/macports-cache/bin/port install libsdl2_image +universal libpng +universal webp +universal jpeg +universal tiff +universal zlib +universal
- name: Build
run: |
export PATH=${{ github.workspace }}/macports-cache/bin:$PATH
mkdir -p build
cd build
cmake -G Xcode -DCMAKE_PREFIX_PATH=${{ github.workspace }}/macports-cache -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=${{ secrets.TEAM_ID }} -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="Developer ID Application" ..
cmake --build . --config Release
brew install create-dmg
create-dmg ../dist/macOS/Kens-Labyrinth-macOS-Universal.dmg ../dist/macOS/
- name: Notarize
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
TEAM_ID: ${{ secrets.TEAM_ID }}
NOTARYTOOL_PASSWORD: ${{ secrets.NOTARYTOOL_PASSWORD }}
run: |
echo "Notarizing the app"
xcrun notarytool submit dist/macOS/Kens-Labyrinth-macOS-Universal.dmg --apple-id $APPLE_ID --team-id $TEAM_ID --password $NOTARYTOOL_PASSWORD --wait > notarization.log
echo "Notarization log:"
cat notarization.log
if grep -q "status: Accepted" notarization.log; then
echo "\033[32mNotarization successful"
echo "Stapling the ticket to the app"
xcrun stapler staple dist/macOS/Kens-Labyrinth-macOS-Universal.dmg
else
echo "\033[31mNotarization failed"
ID=$(grep "id:" notarization.log | sed 's/.*: //' | head -n 1)
echo "Notarization log:"
xcrun notarytool log ${ID} --apple-id $APPLE_ID --team-id $TEAM_ID --password $NOTARYTOOL_PASSWORD notarization_log.json
cat notarization_log.json
exit 1
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-macOS-Universal
path: dist/macOS/Kens-Labyrinth-macOS-Universal.dmg
if-no-files-found: error
build_windows:
name: Build for Windows for ARM64, x86 and x64
runs-on: windows-2025
steps:
- uses: actions/checkout@v4
- name: Build for ARM64
run: |
mkdir -f build
cd build
cmake -A ARM64 ..
cmake --build . --config Release
cd ..
rmdir -force -recurse build
- name: Upload Windows ARM64 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Windows-ARM64
path: dist/windows/
if-no-files-found: error
- name: Build for x86
run: |
mkdir -f build
cd build
cmake -A Win32 ..
cmake --build . --config Release
cd ..
rmdir -force -recurse build
- name: Upload Windows x86 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Windows-x86
path: dist/windows/
if-no-files-found: error
- name: Build for x64
run: |
mkdir -f build
cd build
cmake -A x64 ..
cmake --build . --config Release
cd ..
rmdir -force -recurse build
- name: Upload Windows x64 artifact
uses: actions/upload-artifact@v4
with:
name: Kens-Labyrinth-Windows-x64
path: dist/windows/
if-no-files-found: error