diff --git a/.github/workflows/Linux_multi.yml b/.github/workflows/Linux_multi.yml new file mode 100644 index 00000000000..bb0ca7117d0 --- /dev/null +++ b/.github/workflows/Linux_multi.yml @@ -0,0 +1,117 @@ +name: Linux Multiplatform Build + +on: + push: + branches: + - master + paths-ignore: + - '*.md' + - 'docs/**' + pull_request: + types: [opened, synchronize] + paths-ignore: + - '*.md' + - 'docs/**' + release: + types: [published] + paths-ignore: + - '*.md' + - 'docs/**' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + fail-fast: true + matrix: + platform: + - linux/amd64 + - linux/arm64/v8 + os: + - ubuntu-24.04 + - ubuntu-24.04-arm + exclude: + - os: ubuntu-24.04 + platform: linux/arm64/v8 + - os: ubuntu-24.04-arm + platform: linux/amd64 + include: + - os: ubuntu-24.04 + platform: linux/amd64 + arch: x86_64 + - os: ubuntu-24.04-arm + platform: linux/arm64/v8 + arch: aarch64 + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Installs dependencies, including arm64 libraries (runs `sudo apt-get update` as part of it) + - name: Install dependencies + run: Packaging/nix/debian-host-prep.sh + + - name: Cache CMake build folder + uses: actions/cache@v4 + with: + path: build + key: ${{ github.workflow }}-v8-${{ github.sha }} + restore-keys: ${{ github.workflow }}-v8- + + - name: Build + working-directory: ${{github.workspace}} + env: + CMAKE_BUILD_TYPE: ${{github.event_name == 'release' && 'Release' || 'RelWithDebInfo'}} + # We set DEVILUTIONX_SYSTEM_LIBFMT=OFF because its soversion changes frequently. + # We set DEVILUTIONX_SYSTEM_LIBSODIUM=OFF because its soversion changes frequently. + # We set DEVILUTIONX_SYSTEM_BZIP2=OFF because Fedora and Debian do not agree on how to link it. + run: | + cmake \ + -S. \ + -Bbuild \ + -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCPACK=ON \ + -DDISCORD_INTEGRATION=ON \ + -DBUILD_TESTING=OFF \ + -DDEVILUTIONX_SYSTEM_LIBFMT=OFF \ + -DDEVILUTIONX_SYSTEM_LIBSODIUM=OFF \ + -DDEVILUTIONX_SYSTEM_BZIP2=OFF && \ + cmake --build build -j $(getconf _NPROCESSORS_ONLN) --target package + + - name: Package + run: Packaging/nix/LinuxReleasePackaging.sh && mv devilutionx.tar.xz devilutionx-${{ matrix.arch }}-linux-gnu.tar.xz + + - name: Package AppImage + run: Packaging/nix/AppImage.sh && mv devilutionx.appimage devilutionx-${{ matrix.arch }}-linux-gnu.appimage + + - name: Upload Package + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v4 + with: + name: devilutionx-${{ matrix.arch }}-linux-gnu.tar.xz + path: devilutionx-${{ matrix.arch }}-linux-gnu.tar.xz + + - name: Upload AppImage + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v4 + with: + name: devilutionx-${{ matrix.arch }}-linux-gnu.appimage + path: devilutionx-${{ matrix.arch }}-linux-gnu.appimage + + - name: Update Release + if: ${{ github.event_name == 'release' && !env.ACT }} + uses: svenstaro/upload-release-action@v2 + with: + file: devilutionx-${{ matrix.arch }}-linux-gnu.* + file_glob: true + overwrite: true + + - name: Clean up artifacts + run: rm -rf build/_CPack_Packages build/package build/*.deb build/*.rpm build/*.appimage build/*.tar.xz