build-windows.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. parameters:
  2. name: 'BuildWindows'
  3. vmImage: 'windows-2019'
  4. arch: '64' # or '32'
  5. jobs:
  6. - job: ${{ parameters.name }}
  7. pool:
  8. vmImage: ${{ parameters.vmImage }}
  9. variables:
  10. OPAMYES: 1
  11. ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }}:
  12. ADD_REVISION: 1
  13. CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
  14. ${{ if eq(parameters.arch, '64') }}:
  15. ARCH: 64
  16. MINGW_ARCH: x86_64
  17. CYGWIN_SETUP: https://cygwin.com/setup-x86_64.exe
  18. CYG_ROOT: C:/cygwin64
  19. ${{ if eq(parameters.arch, '32') }}:
  20. ARCH: 32
  21. MINGW_ARCH: i686
  22. CYGWIN_SETUP: https://cygwin.com/setup-x86.exe
  23. CYG_ROOT: C:/cygwin
  24. steps:
  25. - checkout: self
  26. submodules: recursive
  27. - powershell: |
  28. Set-PSDebug -Trace 1
  29. choco install --no-progress nsis.portable --version 3.02 -y
  30. choco install --no-progress curl wget 7zip.portable -y
  31. displayName: Install dependencies
  32. - powershell: Write-Host "##vso[task.prependpath]C:\ProgramData\chocolatey\bin"
  33. displayName: Prepend Chocolatey path
  34. - template: install-neko-snapshot.yaml
  35. parameters:
  36. ${{ if eq(parameters.arch, '64') }}:
  37. platform: windows64
  38. ${{ if eq(parameters.arch, '32') }}:
  39. platform: windows
  40. - powershell: |
  41. Set-PSDebug -Trace 1
  42. curl.exe -fsSL -o cygwin-setup.exe --retry 3 $(CYGWIN_SETUP)
  43. Start-Process -FilePath "cygwin-setup.exe" -ArgumentList "-B -q -R $(CYG_ROOT) -l C:/tmp -s $(CYG_MIRROR) -P default -P make -P git -P zlib-devel -P rsync -P patch -P diffutils -P curl -P unzip -P tar -P m4 -P perl -P libpcre-devel -P mbedtls-devel -P mingw64-$(MINGW_ARCH)-zlib -P mingw64-$(MINGW_ARCH)-gcc-core -P mingw64-$(MINGW_ARCH)-pcre" -Wait
  44. curl.exe -fsSL -o "opam.tar.xz" --retry 3 https://github.com/fdopen/opam-repository-mingw/releases/download/0.0.0.2/opam$(ARCH).tar.xz
  45. curl.exe -fsSL -o "libmbedtls.tar.xz" --retry 3 https://github.com/Simn/mingw64-mbedtls/releases/download/2.16.3/mingw64-$(MINGW_ARCH)-mbedtls-2.16.3-1.tar.xz
  46. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'echo "$OLDPWD"')
  47. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -C / -xvf libmbedtls.tar.xz')
  48. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -xf opam.tar.xz')
  49. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && bash opam$(ARCH)/install.sh')
  50. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam init mingw "https://github.com/fdopen/opam-repository-mingw.git#opam2" --comp 4.07.0+mingw$(ARCH)c --switch 4.07.0+mingw$(ARCH)c --auto-setup --yes 2>&1')
  51. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam update --yes 2>&1')
  52. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam pin add haxe . --kind=path --no-action --yes 2>&1')
  53. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam install haxe --deps-only --yes 2>&1')
  54. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam list')
  55. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'ocamlopt -v')
  56. displayName: Install OCaml and OCaml libraries
  57. - powershell: Write-Host "##vso[task.prependpath]${env:CYG_ROOT}/usr/$(MINGW_ARCH)-w64-mingw32/sys-root/mingw/bin"
  58. displayName: Expose mingw dll files
  59. - powershell: |
  60. Set-PSDebug -Trace 1
  61. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win -j`nproc` haxe 2>&1')
  62. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win haxelib 2>&1')
  63. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -f Makefile.win echo_package_files package_bin package_installer_win package_choco 2>&1')
  64. dir out
  65. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxe.exe')
  66. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
  67. displayName: Build Haxe
  68. - task: PublishPipelineArtifact@0
  69. inputs:
  70. artifactName: 'win$(ARCH)Binaries'
  71. targetPath: out