aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release-binaries.yml
blob: 1a8083febbbed842ae2f38a62f0f95bf6c5c5ac2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: release-binaries

on:
  workflow_dispatch:
    inputs:
      publish_release:
        description: Publish the binaries as a GitHub release
        type: boolean
        default: true
  push:
    branches:
      - nx2

permissions:
  contents: read

concurrency:
  group: release-binaries-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    name: ${{ matrix.platform }} binary
    runs-on: ${{ matrix.runner }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - platform: linux-x86_64
            runner: ubuntu-24.04
          - platform: windows-x86_64
            runner: windows-2022

    steps:
      - name: Check out source
        uses: actions/checkout@v4

      - name: Install Linux dependencies
        if: matrix.platform == 'linux-x86_64'
        shell: bash
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends \
            autoconf cmake g++ gcc git glslang-tools libglu1-mesa-dev \
            libpulse-dev libtool libudev-dev libxkbcommon-x11-0 \
            mesa-common-dev nasm ninja-build qt6-base-private-dev \
            qt6-charts-dev qt6-tools-dev libavfilter-dev libavcodec-dev \
            libswscale-dev pkg-config zlib1g-dev libva-dev libvdpau-dev \
            spirv-tools spirv-headers libusb-1.0-0-dev \
            libboost-dev libboost-fiber-dev libboost-context-dev \
            libopus-dev libasound2-dev

      - name: Install Qt on Linux
        if: matrix.platform == 'linux-x86_64'
        uses: jurplel/install-qt-action@v4
        with:
          version: '6.8.3'
          host: linux
          target: desktop
          arch: linux_gcc_64
          modules: qtcharts
          cache: true

      - name: Set up MSVC
        if: matrix.platform == 'windows-x86_64'
        uses: ilammy/msvc-dev-cmd@v1

      - name: Install Qt on Windows
        if: matrix.platform == 'windows-x86_64'
        uses: jurplel/install-qt-action@v4
        with:
          version: '6.8.3'
          host: windows
          target: desktop
          arch: win64_msvc2022_64
          modules: qtcharts
          cache: true

      - name: Install Vulkan SDK on Windows
        if: matrix.platform == 'windows-x86_64'
        shell: pwsh
        run: ./tools/windows/install-vulkan-sdk.ps1

      - name: Verify Vulkan tools on Windows
        if: matrix.platform == 'windows-x86_64'
        shell: pwsh
        run: glslangValidator --version

      - name: Cache CPM downloads
        uses: actions/cache@v4
        with:
          path: .cache/cpm
          key: cpm-${{ runner.os }}-${{ hashFiles('cpmfile.json', 'CMakeLists.txt', 'src/**/CMakeLists.txt') }}
          restore-keys: |
            cpm-${{ runner.os }}-

      - name: Configure Linux
        if: matrix.platform == 'linux-x86_64'
        shell: bash
        run: >-
          cmake -S . -B build/release -G Ninja
          -DCMAKE_BUILD_TYPE=Release
          -DBUILD_TESTING=OFF
          -DYUZU_TESTS=OFF
          -DYUZU_CMD=ON
          -DYUZU_ROOM=OFF
          -DYUZU_ROOM_STANDALONE=OFF
          -DYUZU_USE_BUNDLED_QT=OFF
          -DCMAKE_PREFIX_PATH="$QT_ROOT_DIR"
          -DYUZU_USE_BUNDLED_SDL3=ON
          -DVulkanHeaders_FORCE_BUNDLED=ON
          -DVulkanUtilityLibraries_FORCE_BUNDLED=ON
          -DENABLE_UPDATE_CHECKER=OFF
          -DUSE_DISCORD_PRESENCE=OFF

      - name: Configure Windows
        if: matrix.platform == 'windows-x86_64'
        shell: bash
        run: >-
          cmake -S . -B build/release -G Ninja
          -DCMAKE_BUILD_TYPE=Release
          -DBUILD_TESTING=OFF
          -DYUZU_TESTS=OFF
          -DYUZU_CMD=ON
          -DYUZU_ROOM=OFF
          -DYUZU_ROOM_STANDALONE=OFF
          -DYUZU_USE_BUNDLED_QT=OFF
          -DYUZU_USE_BUNDLED_SDL3=ON
          -DENABLE_UPDATE_CHECKER=OFF
          -DUSE_DISCORD_PRESENCE=OFF

      - name: Build
        shell: bash
        run: cmake --build build/release --target yuzu yuzu-cmd --parallel

      - name: Package Linux binary
        if: matrix.platform == 'linux-x86_64'
        shell: bash
        run: |
          test -x build/release/bin/eglantine
          test -x build/release/bin/eden-cli
          tar -C build/release/bin -czf "eglantine-${GITHUB_SHA}-linux-x86_64.tar.gz" eglantine eden-cli

      - name: Package Windows binary
        if: matrix.platform == 'windows-x86_64'
        shell: pwsh
        run: |
          foreach ($exe in 'eglantine.exe', 'eden-cli.exe') {
            if (-not (Test-Path "build/release/bin/$exe")) {
              throw "build/release/bin/$exe was not produced"
            }
          }
          windeployqt --release --no-translations build/release/bin/eglantine.exe
          Compress-Archive -Path build/release/bin/* -DestinationPath "eglantine-${env:GITHUB_SHA}-windows-x86_64.zip"

      - name: Upload binary
        uses: actions/upload-artifact@v4
        with:
          name: eglantine-${{ matrix.platform }}-${{ github.sha }}
          path: eglantine-${{ github.sha }}-${{ matrix.platform }}.*
          if-no-files-found: error
          compression-level: 0
          retention-days: 7

  # Publishes both binaries as a GitHub pre-release once every platform built: on pushes to nx2,
  # and on manual runs unless "Publish the binaries as a GitHub release" is unticked.
  release:
    name: Publish release
    needs: build
    if: github.event_name == 'push' || inputs.publish_release
    runs-on: ubuntu-24.04
    permissions:
      contents: write
    steps:
      - name: Download binaries
        uses: actions/download-artifact@v4
        with:
          pattern: eglantine-*-${{ github.sha }}
          path: dist
          merge-multiple: true

      - name: Create release
        shell: bash
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          ls -la dist
          gh release create "build-${GITHUB_RUN_NUMBER}" dist/* \
            --repo "${GITHUB_REPOSITORY}" \
            --target "${GITHUB_SHA}" \
            --prerelease \
            --title "Eglantine ${GITHUB_REF_NAME} build ${GITHUB_RUN_NUMBER} (${GITHUB_SHA::7})" \
            --notes "Automatic build of ${GITHUB_REF_NAME} at ${GITHUB_SHA}.

          Windows: extract the zip and run eglantine.exe, or eden-cli.exe from a terminal.
          Linux: extract the tar.gz; it needs Qt 6.8 and the libraries Eglantine is built against installed on the system."