build.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. 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: Set executable bit
  57. run: |
  58. chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh
  59. chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
  60. if: github.event_name == 'pull_request' && matrix.platform.os == 'ubuntu-latest'
  61. - name: Upload Ryujinx artifact
  62. uses: actions/upload-artifact@v4
  63. with:
  64. name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}
  65. path: publish
  66. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  67. - name: Upload Ryujinx.Headless.SDL2 artifact
  68. uses: actions/upload-artifact@v4
  69. with:
  70. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.platform.zip_os_name }}
  71. path: publish_sdl2_headless
  72. if: github.event_name == 'pull_request' && matrix.platform.os != 'macos-13'
  73. build_macos:
  74. name: macOS Universal (${{ matrix.configuration }})
  75. runs-on: ubuntu-latest
  76. timeout-minutes: 45
  77. strategy:
  78. matrix:
  79. configuration: [ Debug, Release ]
  80. steps:
  81. - uses: actions/checkout@v4
  82. - uses: actions/setup-dotnet@v4
  83. with:
  84. global-json-file: global.json
  85. - name: Setup LLVM 14
  86. run: |
  87. wget https://apt.llvm.org/llvm.sh
  88. chmod +x llvm.sh
  89. sudo ./llvm.sh 14
  90. - name: Install rcodesign
  91. run: |
  92. mkdir -p $HOME/.bin
  93. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  94. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  95. rm apple-codesign.tar.gz
  96. mv rcodesign $HOME/.bin/
  97. echo "$HOME/.bin" >> $GITHUB_PATH
  98. env:
  99. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  100. - name: Get git short hash
  101. id: git_short_hash
  102. run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  103. - name: Change config filename
  104. run: sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/PRConfig\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
  105. shell: bash
  106. if: github.event_name == 'pull_request'
  107. - name: Publish macOS Ryujinx
  108. run: |
  109. ./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"
  110. - name: Publish macOS Ryujinx.Headless.SDL2
  111. run: |
  112. ./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"
  113. - name: Upload Ryujinx artifact
  114. uses: actions/upload-artifact@v4
  115. with:
  116. name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  117. path: "publish/*.tar.gz"
  118. if: github.event_name == 'pull_request'
  119. - name: Upload Ryujinx.Headless.SDL2 artifact
  120. uses: actions/upload-artifact@v4
  121. with:
  122. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  123. path: "publish_headless/*.tar.gz"
  124. if: github.event_name == 'pull_request'