build.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. name: Build job
  2. on:
  3. workflow_call:
  4. concurrency:
  5. group: pr-builds-${{ github.event.number }}
  6. cancel-in-progress: true
  7. env:
  8. POWERSHELL_TELEMETRY_OPTOUT: 1
  9. DOTNET_CLI_TELEMETRY_OPTOUT: 1
  10. RYUJINX_BASE_VERSION: "1.1.0"
  11. jobs:
  12. build:
  13. name: ${{ matrix.OS_NAME }} (${{ matrix.configuration }})
  14. runs-on: ${{ matrix.os }}
  15. timeout-minutes: 45
  16. strategy:
  17. matrix:
  18. os: [ubuntu-latest, macOS-latest, windows-latest]
  19. configuration: [Debug, Release]
  20. include:
  21. - os: ubuntu-latest
  22. OS_NAME: Linux x64
  23. DOTNET_RUNTIME_IDENTIFIER: linux-x64
  24. RELEASE_ZIP_OS_NAME: linux_x64
  25. - os: macOS-latest
  26. OS_NAME: macOS x64
  27. DOTNET_RUNTIME_IDENTIFIER: osx-x64
  28. RELEASE_ZIP_OS_NAME: osx_x64
  29. - os: windows-latest
  30. OS_NAME: Windows x64
  31. DOTNET_RUNTIME_IDENTIFIER: win10-x64
  32. RELEASE_ZIP_OS_NAME: win_x64
  33. fail-fast: false
  34. steps:
  35. - uses: actions/checkout@v3
  36. - uses: actions/setup-dotnet@v3
  37. with:
  38. global-json-file: global.json
  39. - name: Get git short hash
  40. id: git_short_hash
  41. run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  42. shell: bash
  43. - name: Build
  44. run: dotnet build -c "${{ matrix.configuration }}" -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER
  45. - name: Test
  46. uses: TSRBerry/unstable-commands@v1
  47. with:
  48. commands: dotnet test --no-build -c "${{ matrix.configuration }}"
  49. timeout-minutes: 10
  50. retry-codes: 139
  51. - name: Publish Ryujinx
  52. 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
  53. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  54. - name: Publish Ryujinx.Headless.SDL2
  55. 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
  56. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  57. - name: Publish Ryujinx.Ava
  58. 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
  59. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  60. - name: Set executable bit
  61. run: |
  62. chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh
  63. chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
  64. chmod +x ./publish_ava/Ryujinx.Ava ./publish_ava/Ryujinx.sh
  65. if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
  66. - name: Upload Ryujinx artifact
  67. uses: actions/upload-artifact@v3
  68. with:
  69. name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  70. path: publish
  71. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  72. - name: Upload Ryujinx.Headless.SDL2 artifact
  73. uses: actions/upload-artifact@v3
  74. with:
  75. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  76. path: publish_sdl2_headless
  77. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  78. - name: Upload Ryujinx.Ava artifact
  79. uses: actions/upload-artifact@v3
  80. with:
  81. name: ava-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  82. path: publish_ava
  83. if: github.event_name == 'pull_request' && matrix.os != 'macOS-latest'
  84. build_macos:
  85. name: macOS Universal (${{ matrix.configuration }})
  86. runs-on: ubuntu-latest
  87. timeout-minutes: 45
  88. strategy:
  89. matrix:
  90. configuration: [ Debug, Release ]
  91. steps:
  92. - uses: actions/checkout@v3
  93. - uses: actions/setup-dotnet@v3
  94. with:
  95. global-json-file: global.json
  96. - name: Setup LLVM 14
  97. run: |
  98. wget https://apt.llvm.org/llvm.sh
  99. chmod +x llvm.sh
  100. sudo ./llvm.sh 14
  101. - name: Install rcodesign
  102. run: |
  103. mkdir -p $HOME/.bin
  104. gh release download -R indygreg/apple-platform-rs -O apple-codesign.tar.gz -p 'apple-codesign-*-x86_64-unknown-linux-musl.tar.gz'
  105. tar -xzvf apple-codesign.tar.gz --wildcards '*/rcodesign' --strip-components=1
  106. rm apple-codesign.tar.gz
  107. mv rcodesign $HOME/.bin/
  108. echo "$HOME/.bin" >> $GITHUB_PATH
  109. env:
  110. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  111. - name: Get git short hash
  112. id: git_short_hash
  113. run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  114. - name: Publish macOS
  115. run: |
  116. ./distribution/macos/create_macos_build.sh . publish_tmp publish_ava ./distribution/macos/entitlements.xml "${{ env.RYUJINX_BASE_VERSION }}" "${{ steps.git_short_hash.outputs.result }}" "${{ matrix.configuration }}" "-p:ExtraDefineConstants=DISABLE_UPDATER"
  117. - name: Upload Ryujinx.Ava artifact
  118. uses: actions/upload-artifact@v3
  119. with:
  120. name: ava-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal
  121. path: "publish_ava/*.tar.gz"
  122. if: github.event_name == 'pull_request'