build.yml 8.9 KB

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