main.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. # TODO: support skip ci (https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8)
  2. name: CI
  3. on: [push, pull_request]
  4. jobs:
  5. cancel:
  6. name: "Cancel previous runs"
  7. runs-on: ubuntu-latest
  8. timeout-minutes: 3
  9. steps:
  10. - uses: styfle/[email protected]
  11. with:
  12. workflow_id: 1447568
  13. access_token: ${{ github.token }}
  14. windows64-build:
  15. runs-on: windows-latest
  16. env:
  17. ACTIONS_ALLOW_UNSECURE_COMMANDS: true
  18. PLATFORM: windows64
  19. OPAMYES: 1
  20. CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
  21. ARCH: 64
  22. MINGW_ARCH: x86_64
  23. CYGWIN_SETUP: https://cygwin.com/setup-x86_64.exe
  24. CYG_ROOT: C:/cygwin64
  25. steps:
  26. - uses: actions/checkout@main
  27. with:
  28. submodules: recursive
  29. @import install-neko.yml
  30. @import build-windows.yml
  31. windows-build:
  32. runs-on: windows-latest
  33. env:
  34. ACTIONS_ALLOW_UNSECURE_COMMANDS: true
  35. PLATFORM: windows
  36. OPAMYES: 1
  37. CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
  38. ARCH: 32
  39. MINGW_ARCH: i686
  40. CYGWIN_SETUP: https://cygwin.com/setup-x86.exe
  41. CYG_ROOT: C:/cygwin
  42. steps:
  43. - uses: actions/checkout@main
  44. with:
  45. submodules: recursive
  46. @import install-neko.yml
  47. @import build-windows.yml
  48. linux-build:
  49. runs-on: ubuntu-latest
  50. env:
  51. PLATFORM: linux64
  52. OPAMYES: 1
  53. steps:
  54. - uses: actions/checkout@main
  55. with:
  56. submodules: recursive
  57. @import install-neko.yml
  58. @import build-linux.yml
  59. mac-build:
  60. runs-on: macos-latest
  61. env:
  62. PLATFORM: mac
  63. OPAMYES: 1
  64. MACOSX_DEPLOYMENT_TARGET: 10.13
  65. steps:
  66. - uses: actions/checkout@main
  67. with:
  68. submodules: recursive
  69. @import install-neko.yml
  70. @import build-mac.yml
  71. windows64-test:
  72. needs: windows64-build
  73. runs-on: windows-latest
  74. env:
  75. ACTIONS_ALLOW_UNSECURE_COMMANDS: true
  76. PLATFORM: windows64
  77. TEST: ${{matrix.target}}
  78. HXCPP_COMPILE_CACHE: ~/hxcache
  79. ARCH: 64
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/5024
  84. target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, neko]
  85. steps:
  86. - uses: actions/checkout@main
  87. with:
  88. submodules: recursive
  89. - uses: actions/download-artifact@v1
  90. with:
  91. name: win${{env.ARCH}}Binaries
  92. @import install-neko.yml
  93. @import test-windows.yml
  94. windows-test:
  95. needs: windows-build
  96. runs-on: windows-latest
  97. env:
  98. ACTIONS_ALLOW_UNSECURE_COMMANDS: true
  99. PLATFORM: windows
  100. TEST: ${{matrix.target}}
  101. HXCPP_COMPILE_CACHE: ~/hxcache
  102. ARCH: 32
  103. strategy:
  104. fail-fast: false
  105. matrix:
  106. # TODO jvm: https://github.com/HaxeFoundation/haxe/issues/8601
  107. # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/5024
  108. target: [macro, js, hl, cpp, java, cs, php, python, neko]
  109. steps:
  110. - uses: actions/checkout@main
  111. with:
  112. submodules: recursive
  113. - uses: actions/download-artifact@v1
  114. with:
  115. name: win${{env.ARCH}}Binaries
  116. @import install-neko.yml
  117. @import test-windows.yml
  118. linux-test:
  119. needs: linux-build
  120. runs-on: ubuntu-latest
  121. env:
  122. PLATFORM: linux64
  123. TEST: ${{matrix.target}}
  124. HXCPP_COMPILE_CACHE: ~/hxcache
  125. strategy:
  126. fail-fast: false
  127. matrix:
  128. target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash9, neko]
  129. include:
  130. - target: js
  131. # SAUCE: 1
  132. # SAUCE_TUNNEL_ID: 'linux-test'
  133. # SAUCE_BUILD: '${{env.GITHUB_RUN_NUMBER}}' # $(Build.BuildNumber)
  134. - target: hl
  135. APT_PACKAGES: cmake ninja-build libturbojpeg-dev
  136. - target: cpp
  137. APT_PACKAGES: gcc-multilib g++-multilib
  138. - target: lua
  139. APT_PACKAGES: ncurses-dev
  140. - target: flash9
  141. APT_PACKAGES: libglib2.0-0 libfreetype6 xvfb
  142. steps:
  143. - uses: actions/checkout@main
  144. with:
  145. submodules: recursive
  146. - uses: actions/download-artifact@v1
  147. with:
  148. name: linuxBinaries
  149. @import install-neko.yml
  150. @import test-linux.yml
  151. mac-test:
  152. needs: mac-build
  153. runs-on: macos-latest
  154. env:
  155. PLATFORM: mac
  156. TEST: ${{matrix.target}}
  157. HXCPP_COMPILE_CACHE: ~/hxcache
  158. strategy:
  159. fail-fast: false
  160. matrix:
  161. target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash9, neko]
  162. include:
  163. - target: hl
  164. BREW_PACKAGES: ninja
  165. steps:
  166. - uses: actions/checkout@main
  167. with:
  168. submodules: recursive
  169. - uses: actions/download-artifact@v1
  170. with:
  171. name: macBinaries
  172. @import install-neko.yml
  173. @import test-mac.yml
  174. deploy:
  175. if: github.event_name != 'pull_request'
  176. needs: [linux-test, mac-test, windows-test, windows64-test]
  177. runs-on: ubuntu-18.04
  178. steps:
  179. # this is only needed for to get `COMMIT_DATE`...
  180. # maybe https://github.community/t/expose-commit-timestamp-in-the-github-context-data/16460/3
  181. # would be faster
  182. - name: Checkout the repository
  183. uses: actions/checkout@main
  184. - name: Download build artifacts
  185. uses: actions/download-artifact@v2
  186. - name: Install awscli
  187. run: |
  188. set -ex
  189. sudo apt-get update -qqy
  190. sudo apt-get install -qqy awscli
  191. # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
  192. - name: Extract branch name
  193. id: extract_branch
  194. shell: bash
  195. run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
  196. - name: Upload binaries
  197. shell: bash
  198. env:
  199. AWS_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
  200. AWS_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
  201. HXBUILDS_S3ADDR: ${{ secrets.HXBUILDS_S3ADDR }}
  202. run: |
  203. set -ex
  204. COMMIT_HASH_SHORT=${GITHUB_SHA:0:7}
  205. COMMIT_DATE=`TZ=UTC git show --quiet --date='format-local:%Y-%m-%d' --format="%cd"`
  206. FILE_NAME=haxe_${COMMIT_DATE}_${{ steps.extract_branch.outputs.branch }}_${COMMIT_HASH_SHORT}
  207. aws s3 cp linuxBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux64/${FILE_NAME}.tar.gz
  208. aws s3 cp macBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac/${FILE_NAME}.tar.gz
  209. aws s3 cp macBinaries/*_installer.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac-installer/${FILE_NAME}.tar.gz
  210. aws s3 cp win64Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows64/${FILE_NAME}.zip
  211. aws s3 cp win64Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows64-installer/${FILE_NAME}.zip
  212. aws s3 cp win64Binaries/*.nupkg ${HXBUILDS_S3ADDR}/haxe/windows64-choco/
  213. aws s3 cp win32Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows/${FILE_NAME}.zip
  214. aws s3 cp win32Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows-installer/${FILE_NAME}.zip
  215. aws s3 cp win32Binaries/*.nupkg ${HXBUILDS_S3ADDR}/haxe/windows-choco/
  216. - name: Update "latest"
  217. if: github.ref == 'refs/heads/development'
  218. shell: bash
  219. env:
  220. AWS_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
  221. AWS_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
  222. HXBUILDS_S3ADDR: ${{ secrets.HXBUILDS_S3ADDR }}
  223. run: |
  224. set -ex
  225. aws s3 cp linuxBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux64/haxe_latest.tar.gz
  226. aws s3 cp macBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac/haxe_latest.tar.gz
  227. aws s3 cp macBinaries/*_installer.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac-installer/haxe_latest.tar.gz
  228. aws s3 cp win64Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows64/haxe_latest.zip
  229. aws s3 cp win64Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows64-installer/haxe_latest.zip
  230. aws s3 cp win32Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows/haxe_latest.zip
  231. aws s3 cp win32Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows-installer/haxe_latest.zip
  232. # Chocolatey packages have to be named with version number,
  233. # so let's use web redirection to keep the original file name.
  234. [[ "$HXBUILDS_S3ADDR" =~ s3://([^/]+)(.*) ]] && HXBUILDS_S3BUCKET="${BASH_REMATCH[1]}" && HXBUILDS_S3PATH="${BASH_REMATCH[2]}"
  235. [[ `echo win64Binaries/*.nupkg` =~ win64Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
  236. aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows64-choco/${FILE_NAME} ${HXBUILDS_S3ADDR}/haxe/windows64-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows64-choco/${FILE_NAME}"
  237. [[ `echo win32Binaries/*.nupkg` =~ win32Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
  238. aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows-choco/${FILE_NAME} ${HXBUILDS_S3ADDR}/haxe/windows-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
  239. deploy_apidoc:
  240. if: github.event_name != 'pull_request' # TODO: also only when `GHP_REMOTE` is present
  241. needs: [linux-test, mac-test, windows-test, windows64-test]
  242. runs-on: ubuntu-latest
  243. steps:
  244. - name: Download Haxe
  245. uses: actions/download-artifact@v2
  246. with:
  247. name: linuxBinaries
  248. path: linuxBinaries
  249. - name: Setup Haxe
  250. run: |
  251. set -ex
  252. tar -xf linuxBinaries/*_bin.tar.gz -C linuxBinaries --strip-components=1
  253. sudo mkdir -p /usr/local/bin/
  254. sudo mkdir -p /usr/local/share/haxe/
  255. sudo ln -s `pwd`/linuxBinaries/haxe /usr/local/bin/haxe
  256. sudo ln -s `pwd`/linuxBinaries/haxelib /usr/local/bin/haxelib
  257. sudo ln -s `pwd`/linuxBinaries/std /usr/local/share/haxe/std
  258. - name: Download xmldoc artifact
  259. uses: actions/download-artifact@v2
  260. with:
  261. name: xmldoc
  262. path: xmldoc
  263. - name: Deploy to api.haxe.org
  264. env:
  265. GHP_EMAIL: [email protected]
  266. GHP_USERNAME: Haxe CI Bot
  267. GHP_REMOTE: ${{ secrets.GHP_REMOTE }}
  268. run: |
  269. set -ex
  270. LOCAL="`pwd`/extra/api.haxe.org"
  271. git clone "${GHP_REMOTE}" "${LOCAL}"
  272. haxe --cwd "${LOCAL}" --run ImportXml "`pwd`/xmldoc"