build.yml 7.5 KB

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