build.yml 7.6 KB

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