build.yml 6.4 KB

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