|
| 1 | +name: Linux Builds |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: ${{ matrix.name }} |
| 13 | + runs-on: ${{ matrix.runner }} |
| 14 | + container: |
| 15 | + image: ${{ matrix.container }} |
| 16 | + options: --user 0 |
| 17 | + |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - name: Portable x86_64 |
| 23 | + runner: ubuntu-22.04 |
| 24 | + container: ubuntu:22.04 |
| 25 | + architecture: x86_64 |
| 26 | + channel: portable |
| 27 | + formats: appimage,tar,deb,rpm |
| 28 | + artifact: Moonlight-linux-portable-x86_64 |
| 29 | + |
| 30 | + - name: Portable ARM64 |
| 31 | + runner: ubuntu-22.04-arm |
| 32 | + container: ubuntu:22.04 |
| 33 | + architecture: aarch64 |
| 34 | + channel: portable |
| 35 | + formats: appimage,tar,deb,rpm |
| 36 | + artifact: Moonlight-linux-portable-arm64 |
| 37 | + |
| 38 | + - name: Steam Runtime 4 x86_64 |
| 39 | + runner: ubuntu-24.04 |
| 40 | + container: registry.gitlab.steamos.cloud/steamrt/steamrt4/sdk:latest |
| 41 | + architecture: x86_64 |
| 42 | + channel: steamrt4 |
| 43 | + formats: tar |
| 44 | + artifact: Moonlight-linux-steamrt4-x86_64 |
| 45 | + |
| 46 | + - name: Steam Runtime 4 ARM64 |
| 47 | + runner: ubuntu-24.04-arm |
| 48 | + container: registry.gitlab.steamos.cloud/steamrt/steamrt4/sdk/arm64:latest |
| 49 | + architecture: aarch64 |
| 50 | + channel: steamrt4 |
| 51 | + formats: tar |
| 52 | + artifact: Moonlight-linux-steamrt4-arm64 |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Bootstrap checkout dependencies |
| 56 | + shell: bash |
| 57 | + env: |
| 58 | + DEBIAN_FRONTEND: noninteractive |
| 59 | + run: | |
| 60 | + set -euo pipefail |
| 61 | + apt-get update |
| 62 | + apt-get install -y --no-install-recommends ca-certificates git |
| 63 | +
|
| 64 | + - name: Check out repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + submodules: recursive |
| 68 | + |
| 69 | + - name: Install build and packaging dependencies |
| 70 | + shell: bash |
| 71 | + env: |
| 72 | + DEBIAN_FRONTEND: noninteractive |
| 73 | + run: | |
| 74 | + set -euo pipefail |
| 75 | + apt-get install -y --no-install-recommends \ |
| 76 | + appstream \ |
| 77 | + binutils \ |
| 78 | + build-essential \ |
| 79 | + cmake \ |
| 80 | + curl \ |
| 81 | + desktop-file-utils \ |
| 82 | + dpkg-dev \ |
| 83 | + file \ |
| 84 | + libasound2-dev \ |
| 85 | + libavcodec-dev \ |
| 86 | + libavformat-dev \ |
| 87 | + libavutil-dev \ |
| 88 | + libcurl4-openssl-dev \ |
| 89 | + libdbus-1-dev \ |
| 90 | + libdecor-0-dev \ |
| 91 | + libdrm-dev \ |
| 92 | + libegl1-mesa-dev \ |
| 93 | + libexpat1-dev \ |
| 94 | + libgl-dev \ |
| 95 | + libgles2-mesa-dev \ |
| 96 | + libibus-1.0-dev \ |
| 97 | + libjansson-dev \ |
| 98 | + libmbedtls-dev \ |
| 99 | + libopus-dev \ |
| 100 | + libpipewire-0.3-dev \ |
| 101 | + libpng-dev \ |
| 102 | + libpulse-dev \ |
| 103 | + libsamplerate0-dev \ |
| 104 | + libswresample-dev \ |
| 105 | + libudev-dev \ |
| 106 | + libunwind-dev \ |
| 107 | + liburing-dev \ |
| 108 | + libva-dev \ |
| 109 | + libvdpau-dev \ |
| 110 | + libwayland-dev \ |
| 111 | + libx11-dev \ |
| 112 | + libxcursor-dev \ |
| 113 | + libxext-dev \ |
| 114 | + libxfixes-dev \ |
| 115 | + libxi-dev \ |
| 116 | + libxkbcommon-dev \ |
| 117 | + libxkbcommon-x11-dev \ |
| 118 | + libxrandr-dev \ |
| 119 | + libxss-dev \ |
| 120 | + libxtst-dev \ |
| 121 | + libzstd-dev \ |
| 122 | + ninja-build \ |
| 123 | + patchelf \ |
| 124 | + pkg-config \ |
| 125 | + rpm \ |
| 126 | + wayland-protocols |
| 127 | +
|
| 128 | + - name: Configure |
| 129 | + shell: bash |
| 130 | + env: |
| 131 | + BUILD_DIR: build/linux-${{ matrix.channel }}-${{ matrix.architecture }} |
| 132 | + run: | |
| 133 | + set -euo pipefail |
| 134 | + cmake -S . -B "$BUILD_DIR" -G Ninja \ |
| 135 | + -DCMAKE_BUILD_TYPE=Release \ |
| 136 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 137 | + -DPLATFORM_DESKTOP=ON \ |
| 138 | + -DMOONLIGHT_DESKTOP_USE_SYSTEM_PACKAGES=ON \ |
| 139 | + -DMOONLIGHT_DESKTOP_EMBED_RESOURCES=ON \ |
| 140 | + -DMOONLIGHT_LINUX_REQUIRE_VAAPI=ON \ |
| 141 | + -DUSE_SDL3=ON |
| 142 | +
|
| 143 | + - name: Build |
| 144 | + shell: bash |
| 145 | + env: |
| 146 | + BUILD_DIR: build/linux-${{ matrix.channel }}-${{ matrix.architecture }} |
| 147 | + run: cmake --build "$BUILD_DIR" --parallel |
| 148 | + |
| 149 | + - name: Validate desktop metadata |
| 150 | + shell: bash |
| 151 | + env: |
| 152 | + BUILD_DIR: build/linux-${{ matrix.channel }}-${{ matrix.architecture }} |
| 153 | + run: | |
| 154 | + set -euo pipefail |
| 155 | + desktop-file-validate app/platforms/linux/ru.xitrix.Moonlight.desktop |
| 156 | + appstreamcli validate --no-net "$BUILD_DIR/ru.xitrix.Moonlight.metainfo.xml" |
| 157 | +
|
| 158 | + - name: Package |
| 159 | + shell: bash |
| 160 | + env: |
| 161 | + BUILD_DIR: build/linux-${{ matrix.channel }}-${{ matrix.architecture }} |
| 162 | + DIST_DIR: build/dist-${{ matrix.channel }}-${{ matrix.architecture }} |
| 163 | + run: | |
| 164 | + set -euo pipefail |
| 165 | + scripts/package-linux.sh \ |
| 166 | + --build-dir "$BUILD_DIR" \ |
| 167 | + --dist-dir "$DIST_DIR" \ |
| 168 | + --arch "${{ matrix.architecture }}" \ |
| 169 | + --channel "${{ matrix.channel }}" \ |
| 170 | + --formats "${{ matrix.formats }}" |
| 171 | +
|
| 172 | + - name: Verify artifacts |
| 173 | + shell: bash |
| 174 | + env: |
| 175 | + DIST_DIR: build/dist-${{ matrix.channel }}-${{ matrix.architecture }} |
| 176 | + run: | |
| 177 | + set -euo pipefail |
| 178 | + test -n "$(find "$DIST_DIR" -maxdepth 1 -type f -print -quit)" |
| 179 | + find "$DIST_DIR" -maxdepth 1 -type f -print -exec file {} \; |
| 180 | +
|
| 181 | + - name: Upload portable AppImage |
| 182 | + if: matrix.channel == 'portable' |
| 183 | + uses: actions/upload-artifact@v4 |
| 184 | + with: |
| 185 | + name: ${{ matrix.artifact }}-appimage |
| 186 | + path: build/dist-${{ matrix.channel }}-${{ matrix.architecture }}/*.AppImage |
| 187 | + if-no-files-found: error |
| 188 | + retention-days: 14 |
| 189 | + |
| 190 | + - name: Upload portable tarball |
| 191 | + if: matrix.channel == 'portable' |
| 192 | + uses: actions/upload-artifact@v4 |
| 193 | + with: |
| 194 | + name: ${{ matrix.artifact }}-tar |
| 195 | + path: build/dist-${{ matrix.channel }}-${{ matrix.architecture }}/*.tar.gz |
| 196 | + if-no-files-found: error |
| 197 | + retention-days: 14 |
| 198 | + |
| 199 | + - name: Upload Debian package |
| 200 | + if: matrix.channel == 'portable' |
| 201 | + uses: actions/upload-artifact@v4 |
| 202 | + with: |
| 203 | + name: ${{ matrix.artifact }}-deb |
| 204 | + path: build/dist-${{ matrix.channel }}-${{ matrix.architecture }}/*.deb |
| 205 | + if-no-files-found: error |
| 206 | + retention-days: 14 |
| 207 | + |
| 208 | + - name: Upload RPM package |
| 209 | + if: matrix.channel == 'portable' |
| 210 | + uses: actions/upload-artifact@v4 |
| 211 | + with: |
| 212 | + name: ${{ matrix.artifact }}-rpm |
| 213 | + path: build/dist-${{ matrix.channel }}-${{ matrix.architecture }}/*.rpm |
| 214 | + if-no-files-found: error |
| 215 | + retention-days: 14 |
| 216 | + |
| 217 | + - name: Upload Steam Runtime bundle |
| 218 | + if: matrix.channel == 'steamrt4' |
| 219 | + uses: actions/upload-artifact@v4 |
| 220 | + with: |
| 221 | + name: ${{ matrix.artifact }} |
| 222 | + path: build/dist-${{ matrix.channel }}-${{ matrix.architecture }}/*.tar.gz |
| 223 | + if-no-files-found: error |
| 224 | + retention-days: 14 |
0 commit comments