build.yml 6.2 KB

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