build.yml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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: 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. - name: Publish Ryujinx
  51. 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
  52. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  53. - name: Publish Ryujinx.Headless.SDL2
  54. 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
  55. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  56. - name: Publish Ryujinx.Ava
  57. 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
  58. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  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_ava/Ryujinx.Ava ./publish_ava/Ryujinx.sh
  64. if: github.event_name == 'pull_request' && matrix.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.RELEASE_ZIP_OS_NAME }}
  69. path: publish
  70. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  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.RELEASE_ZIP_OS_NAME }}
  75. path: publish_sdl2_headless
  76. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  77. - name: Upload Ryujinx.Ava artifact
  78. uses: actions/upload-artifact@v4
  79. with:
  80. name: ava-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  81. path: publish_ava
  82. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  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: Publish macOS Ryujinx.Ava
  114. run: |
  115. ./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"
  116. - name: Publish macOS Ryujinx.Headless.SDL2
  117. run: |
  118. ./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"
  119. - name: Upload Ryujinx.Ava artifact
  120. uses: actions/upload-artifact@v4
  121. with:
  122. name: ava-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  123. path: "publish_ava/*.tar.gz"
  124. if: github.event_name == 'pull_request'
  125. - name: Upload Ryujinx.Headless.SDL2 artifact
  126. uses: actions/upload-artifact@v4
  127. with:
  128. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  129. path: "publish_headless/*.tar.gz"
  130. if: github.event_name == 'pull_request'