build.yml 6.3 KB

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