build.yml 6.0 KB

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