build.yml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. strategy:
  28. matrix:
  29. os: [ubuntu-latest, macOS-latest, windows-latest]
  30. configuration: [Debug, Release]
  31. include:
  32. - os: ubuntu-latest
  33. OS_NAME: Linux x64
  34. DOTNET_RUNTIME_IDENTIFIER: linux-x64
  35. RELEASE_ZIP_OS_NAME: linux_x64
  36. - os: macOS-latest
  37. OS_NAME: MacOS x64
  38. DOTNET_RUNTIME_IDENTIFIER: osx-x64
  39. RELEASE_ZIP_OS_NAME: osx_x64
  40. - os: windows-latest
  41. OS_NAME: Windows x64
  42. DOTNET_RUNTIME_IDENTIFIER: win10-x64
  43. RELEASE_ZIP_OS_NAME: win_x64
  44. fail-fast: false
  45. steps:
  46. - uses: actions/checkout@v3
  47. - uses: actions/setup-dotnet@v3
  48. with:
  49. global-json-file: global.json
  50. - name: Get git short hash
  51. id: git_short_hash
  52. run: echo "result=$(git rev-parse --short "${{ github.sha }}")" >> $GITHUB_OUTPUT
  53. shell: bash
  54. - name: Build
  55. run: dotnet build -c "${{ matrix.configuration }}" -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER
  56. - name: Test
  57. run: dotnet test --no-build -c "${{ matrix.configuration }}"
  58. - name: Publish Ryujinx
  59. 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
  60. if: github.event_name == 'pull_request'
  61. - name: Publish Ryujinx.Headless.SDL2
  62. 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
  63. if: github.event_name == 'pull_request'
  64. - name: Publish Ryujinx.Ava
  65. 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
  66. if: github.event_name == 'pull_request'
  67. - name: Set executable bit
  68. run: |
  69. chmod +x ./publish/Ryujinx ./publish/Ryujinx.sh
  70. chmod +x ./publish_sdl2_headless/Ryujinx.Headless.SDL2 ./publish_sdl2_headless/Ryujinx.sh
  71. chmod +x ./publish_ava/Ryujinx.Ava ./publish_ava/Ryujinx.sh
  72. if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
  73. - name: Upload Ryujinx artifact
  74. uses: actions/upload-artifact@v3
  75. with:
  76. name: ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  77. path: publish
  78. if: github.event_name == 'pull_request'
  79. - name: Upload Ryujinx.Headless.SDL2 artifact
  80. uses: actions/upload-artifact@v3
  81. with:
  82. name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  83. path: publish_sdl2_headless
  84. if: github.event_name == 'pull_request'
  85. - name: Upload Ryujinx.Ava artifact
  86. uses: actions/upload-artifact@v3
  87. with:
  88. name: ava-ryujinx-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-${{ matrix.RELEASE_ZIP_OS_NAME }}
  89. path: publish_ava
  90. if: github.event_name == 'pull_request'
  91. build_macos:
  92. name: MacOS universal (${{ matrix.configuration }})
  93. runs-on: ubuntu-latest
  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'