main.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. #
  2. # Copyright (c) 2008-2022 the Urho3D project.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21. #
  22. ---
  23. name: CI/CD
  24. on:
  25. push:
  26. pull_request:
  27. repository_dispatch: { types: [ 'Warm DBE build cache' ] }
  28. jobs:
  29. init:
  30. name: Init
  31. runs-on: ubuntu-latest
  32. outputs:
  33. skip: ${{ steps.whatchanged.outputs.skip }}
  34. steps:
  35. - name: Checkout
  36. uses: actions/checkout@v2
  37. - name: What changed
  38. id: whatchanged
  39. run: |
  40. git fetch --deepen=1
  41. git log --raw --no-merges -1 |grep '^:' >/tmp/whatchanged
  42. echo ::set-output name=skip::$(grep -cqv 'website/' /tmp/whatchanged; echo $?)
  43. linux:
  44. name: 🐧
  45. runs-on: ubuntu-latest
  46. needs: init
  47. if: needs.init.outputs.skip == '0'
  48. strategy:
  49. fail-fast: false
  50. matrix:
  51. platform:
  52. - linux-gcc
  53. - linux-clang
  54. - mingw
  55. - rpi
  56. - arm
  57. lib-type:
  58. - static
  59. - shared
  60. architecture:
  61. - 64
  62. - 32
  63. build-type:
  64. - rel
  65. - dbg
  66. include:
  67. - { platform: web, lib-type: static, architecture: wasm, build-type: rel }
  68. - { platform: web, lib-type: static, architecture: wasm, build-type: dbg }
  69. - { platform: android, lib-type: static, architecture: all, build-type: both }
  70. - { platform: android, lib-type: shared, architecture: all, build-type: both }
  71. env:
  72. HOST: ${{ github.job }}
  73. PLATFORM: ${{ matrix.platform }}
  74. BUILD_TYPE: ${{ matrix.build-type }}
  75. LIB_TYPE: ${{ matrix.lib-type }}
  76. ARCH: ${{ matrix.architecture }}
  77. DBE_TAG: master
  78. steps:
  79. - name: Checkout
  80. uses: actions/checkout@v2
  81. with: { fetch-depth: 0 }
  82. - name: Free up space
  83. run: |
  84. sudo rm -rf /usr/share/dotnet /usr/local/lib/android
  85. sudo apt-get clean
  86. df -h
  87. if: matrix.platform == 'android' || matrix.build-type == 'dbg'
  88. - name: Source checksum
  89. id: source_checksum
  90. run: rake source_checksum
  91. - name: Cache
  92. uses: actions/cache@v2
  93. with:
  94. path: |
  95. build/cache/.ccache
  96. build/cache/.gradle/caches
  97. build/cache/.gradle/wrapper
  98. key: |
  99. ${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}-${{ matrix.build-type }}-${{ env.DBE_TAG }}-${{ steps.source_checksum.outputs.hexdigest }}
  100. restore-keys: |
  101. ${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}-${{ matrix.build-type }}-${{ env.DBE_TAG }}
  102. ${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}-${{ matrix.build-type }}
  103. - name: DBE
  104. run: rake update_dot_files && script/dockerized.sh ${PLATFORM/-*} env
  105. - name: CMake
  106. run: script/dockerized.sh ${PLATFORM/-*} rake cmake
  107. if: matrix.platform != 'android'
  108. - name: Build
  109. run: script/dockerized.sh ${PLATFORM/-*} rake build
  110. - name: Test
  111. run: script/dockerized.sh ${PLATFORM/-*} rake test
  112. if: startsWith(matrix.platform, 'linux') || matrix.platform == 'android'
  113. - name: Documentation
  114. run: script/dockerized.sh ${PLATFORM/-*} rake doc
  115. - name: Install
  116. run: |
  117. script/dockerized.sh ${PLATFORM/-*} rake install
  118. if [[ $PLATFORM == android ]]; then touch build/cache/.gradle/mark; fi
  119. - name: Scaffolding - new
  120. run: script/dockerized.sh ${PLATFORM/-*} rake new
  121. - name: Scaffolding - build
  122. run: |
  123. cd build/cache/projects/UrhoApp
  124. script/dockerized.sh ${PLATFORM/-*}
  125. - name: Scaffolding - test
  126. run: |
  127. cd build/cache/projects/UrhoApp
  128. script/dockerized.sh ${PLATFORM/-*} rake test
  129. if: matrix.platform == 'android' || startsWith(matrix.platform, 'linux')
  130. - name: Scaffolding - cleanup
  131. run: |
  132. if [[ $PLATFORM == android ]]; then
  133. rm -rf build/cache/.m2
  134. find build/cache/.gradle -newer build/cache/.gradle/mark -type d |xargs rm -rf
  135. else
  136. rm -rf build/cache/{.urho3d,projects}
  137. fi
  138. - name: Package
  139. run: script/dockerized.sh ${PLATFORM/-*} rake package
  140. if: github.event_name == 'push' && matrix.platform != 'android'
  141. - name: Upload
  142. uses: actions/upload-artifact@v2
  143. with:
  144. name: ${{ matrix.platform }}-${{ matrix.lib-type }}-${{ matrix.architecture }}-${{ matrix.build-type }}
  145. path: |
  146. build/ci/*.tar.gz
  147. android/urho3d-lib/build/distributions/*.aar
  148. android/urho3d-lib/build/distributions/*.zip
  149. android/urho3d-lib/build/libs/*.jar
  150. build/*.out
  151. if: github.event_name == 'push'
  152. continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
  153. - name: Publish
  154. env:
  155. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  156. PUBLISHER_NAME: ${{ secrets.PUBLISHER_NAME }}
  157. PUBLISHER_EMAIL: ${{ secrets.PUBLISHER_EMAIL }}
  158. PUBLISHER_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
  159. BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
  160. BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
  161. run: script/dockerized.sh ${PLATFORM/-*} rake publish
  162. if: |
  163. github.event_name == 'push' &&
  164. (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) &&
  165. (matrix.platform == 'android' || (matrix.platform == 'web' && matrix.build-type == 'rel'))
  166. continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
  167. macOS:
  168. name: 🍏
  169. runs-on: macos-latest
  170. needs: init
  171. if: needs.init.outputs.skip == '0' && github.event_name != 'repository_dispatch'
  172. strategy:
  173. fail-fast: false
  174. matrix:
  175. platform:
  176. - macOS
  177. lib-type:
  178. - static
  179. - shared
  180. include:
  181. - { platform: iOS, lib-type: static }
  182. - { platform: tvOS, lib-type: static }
  183. env:
  184. HOST: ${{ github.job }}
  185. PLATFORM: ${{ matrix.platform }}
  186. LIB_TYPE: ${{ matrix.lib-type }}
  187. steps:
  188. - name: Checkout
  189. uses: actions/checkout@v2
  190. with: { fetch-depth: 0 }
  191. - name: Select xcode
  192. run: sudo xcode-select -s '/Applications/Xcode_12.app'
  193. - name: Install dependencies
  194. run: while ! brew install doxygen graphviz; do sleep 1; done
  195. - name: CMake
  196. run: rake cmake
  197. - name: Build
  198. run: rake build
  199. - name: Test
  200. run: rake test
  201. if: matrix.platform == 'macOS'
  202. - name: Documentation
  203. run: rake doc
  204. - name: Install
  205. run: rake install
  206. - name: Scaffolding - new
  207. run: rake new
  208. - name: Scaffolding - build
  209. run: |
  210. cd ~/projects/UrhoApp
  211. rake
  212. - name: Scaffolding - test
  213. run: |
  214. cd ~/projects/UrhoApp
  215. rake test
  216. if: matrix.platform == 'macOS'
  217. - name: Scaffolding - cleanup
  218. run: rm -rf ~/{.urho3d,projects}
  219. - name: Package
  220. run: rake package
  221. if: github.event_name == 'push'
  222. - name: Upload
  223. uses: actions/upload-artifact@v2
  224. with:
  225. name: ${{ matrix.platform }}-${{ matrix.lib-type }}-all-rel
  226. path: build/ci/*.tar.gz
  227. if: github.event_name == 'push'
  228. windows:
  229. name: 🔲
  230. runs-on: windows-latest
  231. needs: init
  232. if: needs.init.outputs.skip == '0' && github.event_name != 'repository_dispatch'
  233. strategy:
  234. fail-fast: false
  235. matrix:
  236. platform:
  237. - win-vs
  238. - win-gcc
  239. lib-type:
  240. - static
  241. - shared
  242. graphics-api:
  243. - DX11
  244. - DX9
  245. - OpenGL
  246. env:
  247. HOST: ${{ github.job }}
  248. PLATFORM: ${{ matrix.platform }}
  249. LIB_TYPE: ${{ matrix.lib-type }}
  250. GRAPHICS_API: ${{ matrix.graphics-api }}
  251. steps:
  252. - name: Checkout
  253. uses: actions/checkout@v2
  254. with: { fetch-depth: 0 }
  255. - name: Install dependencies
  256. id: install_dependencies
  257. run: |
  258. # Temporary use old version of Doxygen https://github.com/urho3d/Urho3D/issues/2757
  259. choco install --no-progress doxygen.install --version 1.8.20
  260. choco install --no-progress graphviz.portable
  261. continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
  262. - name: CMake
  263. run: rake cmake
  264. - name: Build
  265. run: rake build
  266. - name: Test
  267. run: rake test
  268. if: matrix.graphics-api != 'OpenGL'
  269. - name: Documentation
  270. run: rake doc
  271. if: steps.install_dependencies.outcome == 'success'
  272. - name: Install
  273. run: rake install
  274. - name: Scaffolding - new
  275. run: rake new
  276. - name: Scaffolding - build
  277. run: |
  278. cd ~/projects/UrhoApp
  279. rake
  280. - name: Scaffolding - test
  281. run: |
  282. cd ~/projects/UrhoApp
  283. rake test
  284. if: matrix.graphics-api != 'OpenGL'
  285. - name: Scaffolding - cleanup
  286. run: rm -r -fo ~/.urho3d, ~/Projects
  287. - name: Package
  288. run: rake package
  289. if: github.event_name == 'push'
  290. - name: Upload
  291. uses: actions/upload-artifact@v2
  292. with:
  293. name: ${{ matrix.platform }}-${{ matrix.lib-type }}-64-${{ matrix.graphics-api }}-rel
  294. path: build/ci/*.zip
  295. if: github.event_name == 'push'
  296. ...
  297. # vi: set ts=2 sw=2 expandtab: