build.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # SPDX-FileCopyrightText: 2022 yuzu Emulator Project
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. name: 'yuzu verify'
  4. on:
  5. push:
  6. # branches: [ main ]
  7. tags: [ "*" ]
  8. pull_request:
  9. branches: [ main ]
  10. env:
  11. PR_NUMBER: pr${{ github.event.number }}
  12. jobs:
  13. format:
  14. name: 'verify format'
  15. runs-on: ubuntu-latest
  16. container:
  17. image: yuzuemu/build-environments:linux-clang-format
  18. options: -u 1001
  19. steps:
  20. - uses: actions/checkout@v3
  21. with:
  22. submodules: false
  23. - name: 'Verify Formatting'
  24. run: bash -ex ./.ci/scripts/format/script.sh
  25. build:
  26. name: 'test build'
  27. needs: format
  28. runs-on: ubuntu-latest
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. include:
  33. - type: clang
  34. image: linux-fresh
  35. - type: linux
  36. image: linux-fresh
  37. - type: windows
  38. image: linux-mingw
  39. container:
  40. image: yuzuemu/build-environments:${{ matrix.image }}
  41. options: -u 1001
  42. steps:
  43. - uses: actions/checkout@v3
  44. with:
  45. submodules: recursive
  46. fetch-depth: 0
  47. - name: Set up cache
  48. uses: actions/cache@v3
  49. id: ccache-restore
  50. with:
  51. path: ~/.ccache
  52. key: ${{ runner.os }}-${{ matrix.type }}-${{ github.sha }}
  53. restore-keys: |
  54. ${{ runner.os }}-${{ matrix.type }}-
  55. - name: Create ccache directory
  56. if: steps.ccache-restore.outputs.cache-hit != 'true'
  57. run: mkdir -p ~/.ccache
  58. - name: Build
  59. run: ./.ci/scripts/${{ matrix.type }}/docker.sh
  60. env:
  61. ENABLE_COMPATIBILITY_REPORTING: "ON"
  62. - name: Pack
  63. run: ./.ci/scripts/${{ matrix.type }}/upload.sh
  64. env:
  65. NO_SOURCE_PACK: "YES"
  66. - name: Upload
  67. uses: actions/upload-artifact@v3
  68. with:
  69. name: ${{ matrix.type }}
  70. path: artifacts/
  71. build-msvc:
  72. name: 'test build (windows, msvc)'
  73. needs: format
  74. runs-on: windows-2022
  75. steps:
  76. - name: Set up cache
  77. uses: actions/cache@v3
  78. with:
  79. path: ~/.buildcache
  80. key: ${{ runner.os }}-msvc-${{ github.sha }}
  81. restore-keys: |
  82. ${{ runner.os }}-msvc-
  83. - name: Install dependencies
  84. # due to how chocolatey works, only cmd.exe is supported here
  85. shell: cmd
  86. run: |
  87. choco install vulkan-sdk wget
  88. call refreshenv
  89. wget https://github.com/mbitsnbites/buildcache/releases/download/v0.27.6/buildcache-windows.zip
  90. 7z x buildcache-windows.zip
  91. copy buildcache\bin\buildcache.exe C:\ProgramData\chocolatey\bin
  92. rmdir buildcache
  93. echo %PATH% >> %GITHUB_PATH%
  94. - name: Set up MSVC
  95. uses: ilammy/msvc-dev-cmd@v1
  96. - uses: actions/checkout@v3
  97. with:
  98. submodules: recursive
  99. fetch-depth: 0
  100. - name: Configure
  101. env:
  102. CC: cl.exe
  103. CXX: cl.exe
  104. run: |
  105. glslangValidator --version
  106. mkdir build
  107. cmake . -B build -GNinja -DCMAKE_TOOLCHAIN_FILE="CMakeModules/MSVCCache.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DCMAKE_BUILD_TYPE=Release -DGIT_BRANCH=pr-verify -DYUZU_CRASH_DUMPS=ON
  108. - name: Build
  109. run: cmake --build build
  110. - name: Cache Summary
  111. run: buildcache -s
  112. - name: Pack
  113. shell: pwsh
  114. run: .\.ci\scripts\windows\upload.ps1
  115. - name: Upload
  116. uses: actions/upload-artifact@v3
  117. with:
  118. name: msvc
  119. path: artifacts/
  120. - name: Upload EXE
  121. uses: actions/upload-artifact@v3
  122. with:
  123. name: ${{ env.INDIVIDUAL_EXE }}
  124. path: ${{ env.INDIVIDUAL_EXE }}
  125. android:
  126. runs-on: ubuntu-latest
  127. needs: format
  128. steps:
  129. - uses: actions/checkout@v3
  130. with:
  131. submodules: recursive
  132. - name: Set up cache
  133. uses: actions/cache@v3
  134. with:
  135. path: |
  136. ~/.gradle/caches
  137. ~/.gradle/wrapper
  138. ~/.ccache
  139. key: ${{ runner.os }}-android-${{ github.sha }}
  140. restore-keys: |
  141. ${{ runner.os }}-android-
  142. - name: Query tag name
  143. uses: olegtarasov/get-tag@v2.1.2
  144. id: tagName
  145. - name: Install dependencies
  146. run: |
  147. sudo apt-get update
  148. sudo apt-get install -y ccache apksigner glslang-dev glslang-tools
  149. git -C ./externals/vcpkg/ fetch --all --unshallow
  150. - name: Build
  151. run: ./.ci/scripts/android/build.sh
  152. - name: Copy and sign artifacts
  153. env:
  154. ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
  155. ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
  156. ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
  157. run: ./.ci/scripts/android/upload.sh
  158. - name: Upload
  159. uses: actions/upload-artifact@v3
  160. with:
  161. name: android
  162. path: artifacts/
  163. release:
  164. runs-on: ubuntu-latest
  165. needs: [ android ]
  166. if: ${{ startsWith(github.ref, 'refs/tags/') }}
  167. steps:
  168. - uses: actions/download-artifact@v3
  169. - name: Create release
  170. uses: actions/create-release@v1
  171. env:
  172. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  173. with:
  174. tag_name: ${{ github.ref_name }}
  175. release_name: ${{ github.ref_name }}
  176. draft: false
  177. prerelease: false
  178. - name: Upload artifacts
  179. uses: alexellis/upload-assets@0.4.0
  180. env:
  181. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  182. with:
  183. asset_paths: '["./**/*.tar.*","./**/*.AppImage","./**/*.7z","./**/*.zip","./**/*.apk","./**/*.aab"]'