build.yml 6.1 KB

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