build.yml
1 name: Build job 2 3 on: 4 workflow_call: 5 6 env: 7 POWERSHELL_TELEMETRY_OPTOUT: 1 8 DOTNET_CLI_TELEMETRY_OPTOUT: 1 9 RYUJINX_BASE_VERSION: "1.1.0" 10 11 jobs: 12 build: 13 name: ${{ matrix.platform.name }} (${{ matrix.configuration }}) 14 runs-on: ${{ matrix.platform.os }} 15 timeout-minutes: 45 16 strategy: 17 matrix: 18 configuration: [Debug, Release] 19 platform: 20 - { name: win-x64, os: windows-latest, zip_os_name: win_x64 } 21 - { name: linux-x64, os: ubuntu-latest, zip_os_name: linux_x64 } 22 - { name: linux-arm64, os: ubuntu-latest, zip_os_name: linux_arm64 } 23 - { name: osx-x64, os: macos-13, zip_os_name: osx_x64 } 24 25 fail-fast: false 26 steps: 27 - uses: actions/checkout@v4 28 29 - uses: actions/setup-dotnet@v4 30 with: 31 global-json-file: global.json 32 33 - name: Overwrite csc problem matcher 34 run: echo "::add-matcher::.github/csc.json" 35 36 - name: Get git short hash 37 id: git_short_hash 38 run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT 39 shell: bash 40 41 - name: Change config filename 42 run: sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs 43 shell: bash 44 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 45 46 - name: Change config filename for macOS 47 run: sed -r -i '' 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs 48 shell: bash 49 if: github.event_name == 'pull_request' && matrix.platform.os == 'macos-13' 50 51 - name: Build 52 run: dotnet build -c "${{ matrix.configuration }}" -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER 53 54 - name: Test 55 uses: TSRBerry/unstable-commands@v1 56 with: 57 commands: dotnet test --no-build -c "${{ matrix.configuration }}" 58 timeout-minutes: 10 59 retry-codes: 139 60 if: matrix.platform.name != 'linux-arm64' 61 62 - name: Publish Ryujinx 63 run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.platform.name }}" -o ./publish -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx --self-contained true 64 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 65 66 - name: Publish Ryujinx.Headless.SDL2 67 run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.platform.name }}" -o ./publish_sdl2_headless -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx.Headless.SDL2 --self-contained true 68 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 69 70 - name: Publish Ryujinx.Gtk3 71 run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.platform.name }}" -o ./publish_gtk -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx.Gtk3 --self-contained true 72 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 73 74 - name: Set executable bit 75 run: | 76 chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh 77 chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh 78 chmod +x ./publish_gtk/Ryujinx.Gtk3 ./publish_gtk/Ryujinx.sh 79 if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest' 80 81 - name: Upload Ryujinx artifact 82 uses: actions/upload-artifact@v4 83 with: 84 name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }} 85 path: publish 86 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 87 88 - name: Upload Ryujinx.Headless.SDL2 artifact 89 uses: actions/upload-artifact@v4 90 with: 91 name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }} 92 path: publish_sdl2_headless 93 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 94 95 - name: Upload Ryujinx.Gtk3 artifact 96 uses: actions/upload-artifact@v4 97 with: 98 name: gtk-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }} 99 path: publish_gtk 100 if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13' 101 102 build_macos: 103 name: macOS Universal (${{ matrix.configuration }}) 104 runs-on: ubuntu-latest 105 timeout-minutes: 45 106 strategy: 107 matrix: 108 configuration: [ Debug, Release ] 109 110 steps: 111 - uses: actions/checkout@v4 112 113 - uses: actions/setup-dotnet@v4 114 with: 115 global-json-file: global.json 116 117 - name: Setup LLVM 14 118 run: | 119 wget https://apt.llvm.org/llvm.sh 120 chmod +x llvm.sh 121 sudo ./llvm.sh 14 122 123 - name: Install rcodesign 124 run: | 125 mkdir -p $HOME/.bin 126 gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz' 127 tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1 128 rm apple-codesign.tar.gz 129 mv rcodesign $HOME/.bin/ 130 echo "$HOME/.bin" >> $GITHUB_PATH 131 env: 132 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 133 134 - name: Get git short hash 135 id: git_short_hash 136 run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT 137 138 - name: Change config filename 139 run: sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs 140 shell: bash 141 if: github.event_name == 'pull_request' 142 143 - name: Publish macOS Ryujinx 144 run: | 145 ./distribution/macos/create_macos_build_ava.sh . publish_tmp publish ./distribution/macos/entitlements.xml "${{ env.RYUJINX_BASE_VERSION }}" "${{ steps.git_short_hash.outputs.result }}" "${{ matrix.configuration }}" "-p:ExtraDefineConstants=DISABLE_UPDATER" 146 147 - name: Publish macOS Ryujinx.Headless.SDL2 148 run: | 149 ./distribution/macos/create_macos_build_headless.sh . publish_tmp_headless publish_headless ./distribution/macos/entitlements.xml "${{ env.RYUJINX_BASE_VERSION }}" "${{ steps.git_short_hash.outputs.result }}" "${{ matrix.configuration }}" "-p:ExtraDefineConstants=DISABLE_UPDATER" 150 151 - name: Upload Ryujinx artifact 152 uses: actions/upload-artifact@v4 153 with: 154 name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal 155 path: "publish/*.tar.gz" 156 if: github.event_name == 'pull_request' 157 158 - name: Upload Ryujinx.Headless.SDL2 artifact 159 uses: actions/upload-artifact@v4 160 with: 161 name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal 162 path: "publish_headless/*.tar.gz" 163 if: github.event_name == 'pull_request'