main.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. name: 'BUILD'
  2. on:
  3. push:
  4. paths-ignore: ['**.md']
  5. branches: [master]
  6. tags: ['*']
  7. pull_request:
  8. paths-ignore: ['**.md']
  9. branches: [master]
  10. env:
  11. OBS_VERSION: '26.1.2'
  12. PRODUCT_NAME: 'obs-plugin'
  13. QT_VERSION_MAC: '5.15.2'
  14. QT_HASH_MAC: 'a09690095d16b3f476ae6e0f5bf3154effcd6571738c1c40f8abbb83676d2afb'
  15. QT_VERSION_WIN: '5.15.2'
  16. DEPS_VERSION_MAC: '2021-08-17'
  17. DEPS_HASH_MAC: 'fc6b356572c4703d56f5b2deb98e46cddffb29a0d36c988702dd76329efe7072'
  18. DEPS_VERSION_WIN: '2019'
  19. jobs:
  20. clang_check:
  21. name: '01 - Code Format Check'
  22. runs-on: [ubuntu-latest]
  23. steps:
  24. - name: 'Checkout'
  25. uses: actions/checkout@v2.3.3
  26. with:
  27. submodules: 'recursive'
  28. - name: 'Install clang-format'
  29. run: sudo apt-get install -y clang-format-12
  30. - name: 'Run clang-format'
  31. run: |
  32. ./CI/formatcode.sh
  33. ./CI/check-format.sh
  34. macos_build:
  35. name: '02 - macOS (Latest)'
  36. runs-on: [macos-11]
  37. strategy:
  38. matrix:
  39. arch: ['x86_64']
  40. if: always()
  41. needs: [clang_check]
  42. env:
  43. MACOSX_DEPLOYMENT_TARGET: '10.13'
  44. BLOCKED_FORMULAS: 'speexdsp curl php'
  45. CODESIGN_IDENT: '-'
  46. CODESIGN_IDENT_INSTALLER: '-'
  47. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY != '' && secrets.MACOS_SIGNING_INSTALLER_IDENTITY && secrets.MACOS_SIGNING_CERT != '' }}
  48. defaults:
  49. run:
  50. shell: bash
  51. steps:
  52. - name: 'Checkout'
  53. uses: actions/checkout@v2.3.3
  54. with:
  55. path: 'plugin'
  56. submodules: 'recursive'
  57. - name: 'Checkout'
  58. uses: actions/checkout@v2.3.3
  59. with:
  60. repository: 'obsproject/obs-studio'
  61. path: 'obs-studio'
  62. ref: '${{ env.OBS_VERSION }}'
  63. fetch-depth: 0
  64. submodules: 'recursive'
  65. - name: 'Check for Github Labels'
  66. if: github.event_name == 'pull_request'
  67. run: |
  68. if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
  69. echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
  70. else
  71. echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
  72. fi
  73. echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
  74. - name: 'Restore ccache from cache'
  75. id: ccache-cache
  76. uses: actions/cache@v2.1.2
  77. env:
  78. CACHE_NAME: 'ccache-cache'
  79. with:
  80. path: ${{ github.workspace }}/.ccache
  81. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.arch }}-${{ env.CACHE_DATE }}
  82. - name: 'Setup build environment'
  83. run: |
  84. REMOVE_FORMULAS=""
  85. for FORMULA in ${{ env.BLOCKED_FORMULAS }}; do
  86. if [ -d "/usr/local/opt/${FORMULA}" ]; then
  87. REMOVE_FORMULAS="${REMOVE_FORMULAS}${FORMULA} "
  88. fi
  89. done
  90. if [ -n "${REMOVE_FORMULAS}" ]; then
  91. brew uninstall ${REMOVE_FORMULAS}
  92. fi
  93. - name: 'Install dependencies'
  94. run: CI/macos/01_install_dependencies.sh --architecture "${{ matrix.arch }}"
  95. - name: 'Restore libobs and obs-frontend-api from cache'
  96. id: libobs-cache
  97. uses: actions/cache@v2.1.2
  98. env:
  99. CACHE_NAME: 'libobs-cache'
  100. with:
  101. path: |
  102. ${{ github.workspace }}/.cmake/packages/libobs
  103. ${{ github.workspace }}/.cmake/packages/obs-frontend-api
  104. ${{ github.workspace }}/obs-studio/build/libobs
  105. ${{ github.workspace }}/obs-studio/build/UI/obs-frontend-api
  106. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.OBS_VERSION }}
  107. - name: 'Build libobs and obs-frontend-api'
  108. if: steps.libobs-cache.outputs.cache-hit != 'true'
  109. working-directory: 'plugin'
  110. run: CI/macos/02_build_obs-libs.sh --architecture "${{ matrix.arch }}"
  111. - name: 'Install Apple Developer Certificate'
  112. if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true'
  113. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  114. with:
  115. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  116. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  117. - name: 'Set Signing Identity'
  118. if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && env.HAVE_CODESIGN_IDENTITY == 'true'
  119. run: |
  120. echo "CODESIGN_IDENT=${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" >> $GITHUB_ENV
  121. echo "CODESIGN_IDENT_INSTALLER=${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" >> $GITHUB_ENV
  122. - name: 'Build plugin'
  123. working-directory: 'plugin'
  124. run: CI/macos/03_build_plugin.sh --codesign --architecture "${{ matrix.arch }}"
  125. - name: 'Create build artifact'
  126. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  127. working-directory: 'plugin'
  128. run: CI/macos/04_package_plugin.sh --codesign --architecture "${{ matrix.arch }}"
  129. - name: 'Upload build Artifact'
  130. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  131. uses: actions/upload-artifact@v2
  132. with:
  133. name: '${{ env.PRODUCT_NAME }}-macos-${{ matrix.arch }}'
  134. path: '${{ github.workspace }}/plugin/*-macOS.pkg'
  135. linux_build:
  136. name: '02 - Linux (Ubuntu, 20.04)'
  137. runs-on: ${{ matrix.ubuntu }}
  138. strategy:
  139. matrix:
  140. ubuntu: ['ubuntu-20.04', 'ubuntu-18.04']
  141. if: always()
  142. needs: [clang_check]
  143. defaults:
  144. run:
  145. shell: bash
  146. steps:
  147. - name: 'Checkout'
  148. uses: actions/checkout@v2.3.3
  149. with:
  150. path: 'plugin'
  151. submodules: 'recursive'
  152. - name: 'Checkout'
  153. uses: actions/checkout@v2.3.3
  154. with:
  155. repository: 'obsproject/obs-studio'
  156. path: 'obs-studio'
  157. ref: '${{ env.OBS_VERSION }}'
  158. fetch-depth: 0
  159. submodules: 'recursive'
  160. - name: 'Check for Github Labels'
  161. if: github.event_name == 'pull_request'
  162. run: |
  163. if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Seeking Testers")')"; then
  164. echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
  165. else
  166. echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
  167. fi
  168. echo "CACHE_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
  169. - name: 'Restore ccache from cache'
  170. id: ccache-cache
  171. uses: actions/cache@v2.1.2
  172. env:
  173. CACHE_NAME: 'ccache-cache'
  174. with:
  175. path: ${{ github.workspace }}/.ccache
  176. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ matrix.ubuntu }}-${{ env.CACHE_DATE }}
  177. - name: "Install Dependencies"
  178. working-directory: 'plugin'
  179. run: CI/linux/01_install_dependencies.sh --disable-pipewire
  180. - name: 'Restore libobs and obs-frontend-api from cache'
  181. id: libobs-cache
  182. uses: actions/cache@v2.1.2
  183. env:
  184. CACHE_NAME: 'libobs-cache'
  185. with:
  186. path: |
  187. ${{ github.workspace }}/.cmake/packages/libobs
  188. ${{ github.workspace }}/.cmake/packages/obs-frontend-api
  189. ${{ github.workspace }}/obs-studio/CI_BUILD/libobs
  190. ${{ github.workspace }}/obs-studio/CI_BUILD/UI/obs-frontend-api
  191. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.OBS_VERSION }}
  192. - name: 'Build libobs and obs-frontend-api'
  193. if: steps.libobs-cache.outputs.cache-hit != 'true'
  194. working-directory: 'plugin'
  195. run: CI/linux/02_build_obs-libs.sh --disable-pipewire
  196. - name: 'Build plugin'
  197. working-directory: 'plugin'
  198. run: CI/linux/03_build_plugin.sh
  199. - name: 'Create build artifact'
  200. working-directory: 'plugin'
  201. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  202. run: CI/linux/04_package_plugin.sh
  203. - name: 'Upload build Artifact'
  204. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  205. uses: actions/upload-artifact@v2
  206. with:
  207. name: '${{ env.PRODUCT_NAME }}-linux-${{ matrix.arch }}'
  208. path: '${{ github.workspace }}/plugin/*.deb'
  209. windows_build:
  210. name: '02 - Windows (Latest)'
  211. runs-on: [windows-latest]
  212. needs: [clang_check]
  213. if: always()
  214. strategy:
  215. matrix:
  216. arch: [64, 32]
  217. env:
  218. CMAKE_GENERATOR: "Visual Studio 16 2019"
  219. CMAKE_SYSTEM_VERSION: "10.0.18363.657"
  220. steps:
  221. - name: 'Add msbuild to PATH'
  222. uses: microsoft/setup-msbuild@v1.0.2
  223. - name: 'Checkout'
  224. uses: actions/checkout@v2.3.3
  225. with:
  226. path: 'plugin'
  227. submodules: 'recursive'
  228. - name: 'Checkout'
  229. uses: actions/checkout@v2.3.3
  230. with:
  231. repository: 'obsproject/obs-studio'
  232. path: 'obs-studio'
  233. ref: '${{ env.OBS_VERSION }}'
  234. fetch-depth: 0
  235. submodules: 'recursive'
  236. - name: 'Check for Github Labels'
  237. if: github.event_name == 'pull_request'
  238. run: |
  239. $LabelFound = try { (Invoke-RestMethod -Authentication 'Bearer' -Token (ConvertTo-SecureString '${{ secrets.GITHUB_TOKEN }}' -AsPlainText) -Uri "${{ github.event.pull_request.url }}" -UseBasicParsing).labels.name.contains("Seeking Testers") } catch { $false }
  240. Write-Output "SEEKING_TESTERS=$(if( $LabelFound -eq $true ) { 1 } else { 0 })" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
  241. - name: "Install Dependencies"
  242. working-directory: 'plugin'
  243. run: CI/windows/01_install_dependencies.ps1 -BuildArch ${{ matrix.arch }}-bit -NoChoco
  244. - name: 'Restore libobs and obs-frontend-api from cache'
  245. id: libobs-cache
  246. uses: actions/cache@v2.1.2
  247. env:
  248. CACHE_NAME: 'libobs-cache'
  249. with:
  250. path: |
  251. ${{ github.workspace }}/obs-studio/build/libobs
  252. ${{ github.workspace }}/obs-studio/build/UI/obs-frontend-api
  253. ${{ github.workspace }}/obs-studio/build/deps/w32-pthreads
  254. key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.OBS_VERSION }}
  255. - name: 'Build libobs and obs-frontend-api'
  256. working-directory: 'obs-studio'
  257. run: CI/windows/02_build_obs_libs.ps1 -BuildArch "${{ matrix.arch }}-bit"
  258. - name: 'Build plugin'
  259. working-directory: 'plugin'
  260. run: CI/windows/03_build_plugin.ps1 -BuildArch "${{ matrix.arch }}-bit"
  261. - name: 'Create build artifact'
  262. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  263. run: CI/windows/04_package_plugin.ps1 -BuildArch "${{ matrix.arch }}-bit"
  264. - name: 'Upload build Artifact'
  265. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  266. uses: actions/upload-artifact@v2
  267. with:
  268. name: '${{ env.PRODUCT_NAME }}-windows-${{ matrix.arch }}'
  269. path: '${{ github.workspace }}/plugin/*-Win${{ matrix.arch }}.zip'
  270. windows_package:
  271. name: '03 - Windows Installer'
  272. runs-on: [ubuntu-latest]
  273. needs: [windows_build]
  274. if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
  275. steps:
  276. - name: 'Checkout'
  277. uses: actions/checkout@v2.3.3
  278. with:
  279. submodules: 'recursive'
  280. - name: 'Download 64-bit artifact'
  281. uses: actions/download-artifact@v2
  282. with:
  283. name: '${{ env.PRODUCT_NAME }}-windows-64'
  284. path: ${{ github.workspace }}
  285. - name: 'Download 32-bit artifact'
  286. uses: actions/download-artifact@v2
  287. with:
  288. name: '${{ env.PRODUCT_NAME }}-windows-32'
  289. path: ${{ github.workspace }}
  290. - name: 'Build InnoSetup installer'
  291. run: |
  292. Get-ChildItem -Filter "*-Win32.zip" -File | Expand-Archive -DestinationPath ./release/
  293. Get-ChildItem -Filter "*-Win64.zip" -File | Expand-Archive -DestinationPath ./release/
  294. CI/windows/04_package_plugin.ps1 -BuildInstaller -CombinedArchs
  295. - name: 'Upload build Artifact'
  296. if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
  297. uses: actions/upload-artifact@v2
  298. with:
  299. name: '${{ env.PRODUCT_NAME }}-windows-release'
  300. path: '${{ github.workspace }}/plugin/*-Windows-Installer.exe'
  301. macos_release:
  302. name: '03 - macOS notarized image'
  303. runs-on: [macos-latest]
  304. needs: [macos_build]
  305. env:
  306. HAVE_CODESIGN_IDENTITY: ${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY != '' && secrets.MACOS_SIGNING_INSTALLER_IDENTITY && secrets.MACOS_SIGNING_CERT != '' }}
  307. if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request'
  308. defaults:
  309. run:
  310. shell: bash
  311. steps:
  312. - name: 'Checkout'
  313. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  314. uses: actions/checkout@v2.3.3
  315. with:
  316. submodules: 'recursive'
  317. - name: 'Download artifact'
  318. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  319. uses: actions/download-artifact@v2
  320. with:
  321. name: '${{ env.PRODUCT_NAME }}-macos'
  322. - name: 'Install Apple Developer Certificate'
  323. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  324. uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
  325. with:
  326. p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
  327. p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
  328. - name: 'Install prerequisite XCNotary'
  329. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  330. run: brew bundle --file CI/include/Xcnotary
  331. - name: 'Create disk image for distribution'
  332. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  333. env:
  334. CODESIGN_IDENT_USER: '${{ secrets.MACOS_NOTARIZATION_USERNAME }}'
  335. CODESIGN_IDENT_PASS: '${{ secrets.MACOS_NOTARIZATION_PASSWORD }}'
  336. run: CI/macos/04_package_plugin.sh --notarize
  337. - name: 'Upload notarized installer package'
  338. if: env.HAVE_CODESIGN_IDENTITY == 'true'
  339. uses: actions/upload-artifact@v2
  340. with:
  341. name: '${{ env.PRODUCT_NAME }}-macos-release'
  342. path: '${{ github.workspace }}/plugin/*-macOS.pkg'