name: Build on: push: branches: - master pull_request: workflow_dispatch: jobs: windows: name: Windows x64 (Portable Archive) runs-on: windows-latest defaults: run: shell: msys2 {0} steps: - name: Fetch Source Code uses: actions/checkout@v7 with: submodules: recursive - name: Install Dependencies uses: msys2/setup-msys2@v2 with: install: make git jq mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-cmake mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gcc mingw-w64-x86_64-glew mingw-w64-x86_64-libarchive mingw-w64-x86_64-sdl3 - name: Build libarchive run: | # msys2's libarchive assumes a DLL zlib, which breaks when linking hades statically. # We therefore build it ourselves against a static libz.a to fix this. git clone https://github.com/libarchive/libarchive.git archive --branch v3.8.7 --depth 1 # Pre-seeding the ZLIB_WINAPI/ZLIB_DLL cache variables didn't stop libarchive's build # from defining `-DZLIB_DLL` anyway, so force it at the compiler level instead: `-U` # cancels out an earlier `-D` for the same macro on the same compile command, and # CMake always places CMAKE_C_FLAGS after a target's own `-D`s in that command. cmake -S archive -B archive/build \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH="$MSYSTEM_PREFIX" \ -DCMAKE_INSTALL_PREFIX="$MSYSTEM_PREFIX" \ -DCMAKE_C_FLAGS="-UZLIB_DLL -UZLIB_WINAPI" \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_OPENSSL=OFF \ -DENABLE_LIBXML2=OFF \ -DENABLE_TEST=OFF \ -DENABLE_TAR=OFF \ -DENABLE_CPIO=OFF \ -DENABLE_CAT=OFF cmake --build archive/build cmake --install archive/build - name: Build Hades run: | # Setup the Meson project meson setup build --buildtype=release -Dstatic_executable=true echo "HADES_VERSION=$(meson introspect build --projectinfo | jq -r .version)" >> "$GITHUB_ENV" # Build the project ninja -C build - name: Test Hades run: | mv -v build/Hades.exe "hades-${HADES_VERSION}-win-x64.exe" "./hades-${HADES_VERSION}-win-x64.exe" --help - name: Collect Artifacts uses: actions/upload-artifact@v7 with: path: hades-${{ env.HADES_VERSION }}-win-x64.exe archive: false if-no-files-found: error windows-arm: name: Windows ARM64 (Portable Archive) runs-on: windows-11-arm defaults: run: shell: msys2 {0} steps: - name: Setup MSYS2 uses: msys2/setup-msys2@v2 with: msystem: CLANGARM64 release: true install: git jq pacboy: gcc-compat:p toolchain:p ca-certificates:p cmake:p meson:p ninja:p glew:p libarchive:p sdl3:p - name: Fetch Source Code uses: actions/checkout@v7 with: submodules: recursive - name: Build libarchive run: | # msys2's libarchive assumes a DLL zlib, which breaks when linking hades statically. # We therefore build it ourselves against a static libz.a to fix this. git clone https://github.com/libarchive/libarchive.git archive --branch v3.8.7 --depth 1 # Pre-seeding the ZLIB_WINAPI/ZLIB_DLL cache variables didn't stop libarchive's build # from defining `-DZLIB_DLL` anyway, so force it at the compiler level instead: `-U` # cancels out an earlier `-D` for the same macro on the same compile command, and # CMake always places CMAKE_C_FLAGS after a target's own `-D`s in that command. cmake -S archive -B archive/build \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH="$MSYSTEM_PREFIX" \ -DCMAKE_INSTALL_PREFIX="$MSYSTEM_PREFIX" \ -DCMAKE_C_FLAGS="-UZLIB_DLL -UZLIB_WINAPI" \ -DBUILD_SHARED_LIBS=OFF \ -DENABLE_OPENSSL=OFF \ -DENABLE_LIBXML2=OFF \ -DENABLE_TEST=OFF \ -DENABLE_TAR=OFF \ -DENABLE_CPIO=OFF \ -DENABLE_CAT=OFF cmake --build archive/build cmake --install archive/build - name: Build Hades run: | # Setup the Meson project meson setup build --buildtype=release -Dstatic_executable=true echo "HADES_VERSION=$(meson introspect build --projectinfo | jq -r .version)" >> "$GITHUB_ENV" # Build the project ninja -C build - name: Test Hades run: | mv -v build/Hades.exe "hades-${HADES_VERSION}-win-arm64.exe" "./hades-${HADES_VERSION}-win-arm64.exe" --help - name: Collect Artifacts uses: actions/upload-artifact@v7 with: path: hades-${{ env.HADES_VERSION }}-win-arm64.exe archive: false if-no-files-found: error mac-os: name: MacOS arm64 (DMG Installer) runs-on: macos-latest steps: - name: Fetch Source Code uses: actions/checkout@v7 with: submodules: recursive - name: Install Dependencies run: | echo "Installing dependencies" brew install meson ninja create-dmg libarchive # Install glew 2.2.0 because the latest version doesn't ship with a static library anymore brew tap-new hades/dependencies brew extract --version=2.2.0 glew hades/dependencies # The formula extracted from homebrew-core's history carries a `no_autobump!` # directive, which Homebrew only allows in its own official taps. Strip it so # the formula can be loaded from our local tap. tap_repo="$(brew --repository hades/dependencies)" sed -i '' '/no_autobump!/d' "$tap_repo/Formula/glew@2.2.0.rb" brew install hades/dependencies/glew@2.2.0 - name: Build the SDL3 run: | # Source & Documentation: # # https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md # https://github.com/libsdl-org/SDL/blob/main/docs/README-macos.md # Clone the SDL3 git clone https://github.com/libsdl-org/SDL.git sdl --branch release-3.4.0 # Build the SDL3 cd sdl cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 cmake --build build --config Release -j sudo cmake --install build - name: Build Hades for arm64 run: | export PKG_CONFIG_PATH="/opt/homebrew/opt/libarchive/lib/pkgconfig" # Circumvent a bug with meson that fails to find static dependencies of dependencies by providing # a directory containing only the static archives (.a), without the .dylib next to them. mkdir libs-arm64 cp /opt/homebrew/lib/*.a ./libs-arm64/ cp /usr/local/lib/*.a ./libs-arm64/ export LDFLAGS="-L$(pwd)/libs-arm64/" rm -rf /tmp/build/ mkdir -p /tmp/build/Hades.app # Setup the Meson project meson setup build --buildtype=release -Dstatic_dependencies=true --prefix=/tmp/build/Hades.app --bindir=Contents/MacOS echo "HADES_VERSION=$(meson introspect build --projectinfo | jq -r .version)" >> "$GITHUB_ENV" # Build & Install the project ninja -C build install - name: Clean & Polish Hades App run: | echo "Hades (Universal) Dependencies:" otool -L /tmp/build/Hades.app/Contents/MacOS/hades echo "End of dependencies" echo "Hades Dependencies Check" otool -L /tmp/build/Hades.app/Contents/MacOS/hades | grep /opt/homebrew/ && false otool -L /tmp/build/Hades.app/Contents/MacOS/hades | grep /usr/local/ && false # Set permissions chmod +x /tmp/build/Hades.app/Contents/MacOS/hades - name: Test Hades App run: | /tmp/build/Hades.app/Contents/MacOS/hades --help - name: Sign Hades App # Only run if a certificate is set if: ${{ env.MACOS_CODESIGN_CRT != '' && env.MACOS_CODESIGN_CRT_IDENTITY != '' }} run: | echo "Content of the bundle to sign:" echo "---- START ----" find "/tmp/build/Hades.app" | sed -e "s/[^─][^\/]*\// │/g" -e "s/│\([^ ]\)/├── \1/" echo "---- END ----" # Create keychain with certificate to use to sign the binaries. echo "$MACOS_CODESIGN_CRT" | base64 -d > certificate.p12 security create-keychain -p test123 build.keychain security default-keychain -s build.keychain security unlock-keychain -p test123 build.keychain security import certificate.p12 -k build.keychain -P "$MACOS_CODESIGN_CRT_PWD" -T /usr/bin/codesign # Delete certificate to avoid leaking it to next steps rm certificate.p12 security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k test123 build.keychain echo "Signing file /tmp/build/Hades.app" /usr/bin/codesign --deep --force -s "$MACOS_CODESIGN_CRT_IDENTITY" --options runtime "/tmp/build/Hades.app" -v # Get rid of the keychain containing certificate to avoid leaking it # to next steps. security lock-keychain build.keychain security default-keychain -s security delete-keychain build.keychain env: MACOS_CODESIGN_CRT: ${{ secrets.MACOS_CODESIGN_CRT }} MACOS_CODESIGN_CRT_PWD: ${{ secrets.MACOS_CODESIGN_CRT_PWD }} MACOS_CODESIGN_CRT_IDENTITY: ${{ secrets.MACOS_CODESIGN_CRT_IDENTITY }} - name: Create Hades DMG run: | create-dmg \ --volname "Hades Installer" \ --volicon ./resource/macos/hades.icns \ --background ./resource/macos/background.png \ --window-pos 200 120 \ --window-size 575 360 \ --icon-size 100 \ --icon Hades.app 150 225 \ --hide-extension Hades.app \ --app-drop-link 425 225 \ "hades-${HADES_VERSION}-macos-arm64.dmg" \ /tmp/build/ - name: Notarize Hades DMG if: ${{ env.MACOS_APPLE_USERNAME != '' }} run: | echo "Notarizing file $file" xcrun notarytool submit --apple-id "$MACOS_APPLE_USERNAME" --password "$MACOS_APPLE_PASSWORD" --team-id "$MACOS_APPLE_TEAMID" --wait "hades-${HADES_VERSION}-macos-arm64.dmg" xcrun stapler staple -v "hades-${HADES_VERSION}-macos-arm64.dmg" env: MACOS_APPLE_USERNAME: ${{ secrets.MACOS_APPLE_USERNAME }} MACOS_APPLE_PASSWORD: ${{ secrets.MACOS_APPLE_PASSWORD }} MACOS_APPLE_TEAMID: ${{ secrets.MACOS_APPLE_TEAMID }} - name: Collect Artifacts uses: actions/upload-artifact@v7 with: path: hades-${{ env.HADES_VERSION }}-macos-arm64.dmg archive: false if-no-files-found: error linux-appimage: name: Linux x64 (AppImage) runs-on: ubuntu-22.04 steps: - name: Fetch Source Code uses: actions/checkout@v7 with: submodules: recursive - name: Install Dependencies run: | sudo apt-get update sudo apt-get install -y \ meson \ ninja-build \ libfuse2 \ libglew-dev \ libarchive-dev \ libcurl4-openssl-dev \ libudev-dev \ libpipewire-0.3-dev - name: Build the SDL3 run: | # Source & Documentation: # # https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md # https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md # Install all SDL3 build dependencies sudo apt-get install build-essential git make \ pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev \ libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \ libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \ libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev # Clone the SDL3 git clone https://github.com/libsdl-org/SDL.git sdl --branch release-3.4.0 # Build the SDL3 cd sdl cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON cmake --build build --config Release -j sudo cmake --install build --prefix /usr/local - name: Build Hades run: | # Setup the Meson project meson setup build --buildtype=release -Dstatic_sdl3=true -Dwith_wayland=false --prefix=/usr echo "HADES_VERSION=$(meson introspect build --projectinfo | jq -r .version)" >> "$GITHUB_ENV" # Build & Install the project DESTDIR=$(pwd)/AppDir ninja -C build install echo "Content of the package:" echo "---- START ----" find "$(pwd)/AppDir" | sed -e "s/[^─][^\/]*\// │/g" -e "s/│\([^ ]\)/├── \1/" echo "---- END ----" - name: Package Hades uses: AppImageCrafters/build-appimage@master with: recipe: "./resource/linux/AppImageBuilder.yml" - name: Test Hades run: | sudo chown --reference=. *.AppImage mv -v *.AppImage "hades-${HADES_VERSION}-linux-x64.appimage" "./hades-${HADES_VERSION}-linux-x64.appimage" --help - name: Collect Artifacts uses: actions/upload-artifact@v7 with: path: hades-${{ env.HADES_VERSION }}-linux-x64.appimage archive: false if-no-files-found: error linux-ubuntu: name: Linux x64 (Ubuntu ${{ matrix.version }}) runs-on: ubuntu-${{ matrix.version }} strategy: matrix: version: ["22.04", "24.04", "26.04"] steps: - name: Fetch Source Code uses: actions/checkout@v7 with: submodules: recursive - name: Install Dependencies run: | sudo apt-get update sudo apt-get install -y \ meson \ ninja-build \ libglew-dev \ libarchive-dev \ libcurl4-openssl-dev \ libudev-dev \ libpipewire-0.3-dev - name: Build the SDL3 run: | # Source & Documentation: # # https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md # https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md # Install all SDL3 build dependencies sudo apt-get install build-essential git make \ pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev \ libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \ libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \ libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev # Clone the SDL3 git clone https://github.com/libsdl-org/SDL.git sdl --branch release-3.4.0 # Build the SDL3 cd sdl cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON cmake --build build --config Release -j sudo cmake --install build --prefix /usr/local - name: Build Hades run: | meson setup build --buildtype=release -Dstatic_sdl3=true --prefix=/usr HADES_VERSION=$(meson introspect build --projectinfo | jq -r .version) echo "HADES_VERSION=${HADES_VERSION}" >> "$GITHUB_ENV" echo "HADES_DEB_VERSION=$(echo "${HADES_VERSION}" | tr '-' '~')" >> "$GITHUB_ENV" DESTDIR=$(pwd)/pkg-root ninja -C build install echo "Content of the package:" echo "---- START ----" find "$(pwd)/pkg-root" | sed -e "s/[^─][^\/]*\// │/g" -e "s/│\([^ ]\)/├── \1/" echo "---- END ----" - name: Package Hades uses: jiro4989/build-deb-action@v4 with: package: hades package_root: pkg-root maintainer: The Hades Authors version: ${{ env.HADES_DEB_VERSION }} arch: 'amd64' depends: 'libarchive13, libglew2.2, libdecor-0-0, libcurl4' desc: 'A Nintendo Game Boy Advance Emulator.' - name: Test Hades run: | sudo chown --reference=. *.deb mv -v *.deb "hades-${HADES_VERSION}-ubuntu-${{ matrix.version }}-x64.deb" sudo apt install -y "./hades-${HADES_VERSION}-ubuntu-${{ matrix.version }}-x64.deb" /usr/bin/hades --help - name: Collect Artifacts uses: actions/upload-artifact@v7 with: path: hades-${{ env.HADES_VERSION }}-ubuntu-${{ matrix.version }}-x64.deb archive: false if-no-files-found: error