build.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. name: Build job
  2. on:
  3. workflow_call:
  4. env:
  5. POWERSHELL_TELEMETRY_OPTOUT: 1
  6. DOTNET_CLI_TELEMETRY_OPTOUT: 1
  7. RYUJINX_BASE_VERSION: "1.2.0"
  8. RELEASE: 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. run: sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  36. shell: bash
  37. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  38. - name: Change config filename for macOS
  39. run: sed -r -i '' 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  40. shell: bash
  41. if: github.event_name == 'pull_request' && matrix.platform.os == 'macos-13'
  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: Test
  45. uses: TSRBerry/unstable-commands@v1
  46. with:
  47. commands: dotnet test --no-build -c "${{ matrix.configuration }}"
  48. timeout-minutes: 10
  49. retry-codes: 139
  50. if: matrix.platform.name != 'linux-arm64'
  51. - name: Publish Ryujinx
  52. 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
  53. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  54. - name: Publish Ryujinx.Headless.SDL2
  55. 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
  56. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  57. - name: Set executable bit
  58. run: |
  59. chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh
  60. chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
  61. if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
  62. #- name: Build AppImage
  63. # if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
  64. # run: |
  65. # PLATFORM_NAME="${{ matrix.platform.name }}"
  66. # sudo apt install -y zsync desktop-file-utils appstream
  67. # mkdir -p tools
  68. # export PATH="$PATH:$(readlink -f tools)"
  69. # # Setup appimagetool
  70. # wget -q -O tools/appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
  71. # chmod +x tools/appimagetool
  72. # chmod +x distribution/linux/appimage/build-appimage.sh
  73. # Explicitly set $ARCH for appimagetool ($ARCH_NAME is for the file name)
  74. # if [ "$PLATFORM_NAME" = "linux-x64" ]; then
  75. # ARCH_NAME=x64
  76. # export ARCH=x86_64
  77. # elif [ "$PLATFORM_NAME" = "linux-arm64" ]; then
  78. # ARCH_NAME=arm64
  79. # export ARCH=aarch64
  80. # else
  81. # echo "Unexpected PLATFORM_NAME "$PLATFORM_NAME""
  82. # exit 1
  83. # fi
  84. # export UFLAG="gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*-$ARCH_NAME.AppImage.zsync"
  85. # BUILDDIR=publish OUTDIR=publish_appimage distribution/linux/appimage/build-appimage.sh
  86. # shell: bash
  87. - name: Upload Ryujinx artifact
  88. uses: actions/upload-artifact@v4
  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. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  93. #- name: Upload Ryujinx (AppImage) artifact
  94. # uses: actions/upload-artifact@v4
  95. # if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
  96. # with:
  97. # name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}-AppImage
  98. # path: publish_appimage
  99. - name: Upload Ryujinx.Headless.SDL2 artifact
  100. uses: actions/upload-artifact@v4
  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. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  105. build_macos:
  106. name: macOS Universal (${{ matrix.configuration }})
  107. runs-on: ubuntu-latest
  108. timeout-minutes: 45
  109. strategy:
  110. matrix:
  111. configuration: [ Debug, Release ]
  112. steps:
  113. - uses: actions/checkout@v4
  114. - uses: actions/setup-dotnet@v4
  115. with:
  116. global-json-file: global.json
  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. - name: Install rcodesign
  123. run: |
  124. mkdir -p $HOME/.bin
  125. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  126. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  127. rm apple-codesign.tar.gz
  128. mv rcodesign $HOME/.bin/
  129. echo "$HOME/.bin" >> $GITHUB_PATH
  130. env:
  131. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  132. - name: Get git short hash
  133. id: git_short_hash
  134. run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  135. - name: Change config filename
  136. run: sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  137. shell: bash
  138. if: github.event_name == 'pull_request'
  139. - name: Publish macOS Ryujinx
  140. run: |
  141. ./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"
  142. - name: Publish macOS Ryujinx.Headless.SDL2
  143. run: |
  144. ./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"
  145. - name: Upload Ryujinx artifact
  146. uses: actions/upload-artifact@v4
  147. with:
  148. name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  149. path: "publish/*.tar.gz"
  150. if: github.event_name == 'pull_request'
  151. - name: Upload Ryujinx.Headless.SDL2 artifact
  152. uses: actions/upload-artifact@v4
  153. with:
  154. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  155. path: "publish_headless/*.tar.gz"
  156. if: github.event_name == 'pull_request'