build.yml 6.2 KB

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