build-windows.yml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. ADD_REVISION: 1
  12. CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
  13. ${{ if eq(parameters.arch, '64') }}:
  14. ARCH: 64
  15. MINGW_ARCH: x86_64
  16. CYGWIN_SETUP: https://cygwin.com/setup-x86_64.exe
  17. CYG_ROOT: C:/cygwin64
  18. ${{ if eq(parameters.arch, '32') }}:
  19. ARCH: 32
  20. MINGW_ARCH: i686
  21. CYGWIN_SETUP: https://cygwin.com/setup-x86.exe
  22. CYG_ROOT: C:/cygwin
  23. steps:
  24. - checkout: self
  25. submodules: recursive
  26. - powershell: |
  27. Set-PSDebug -Trace 1
  28. choco install --no-progress nsis.portable --version 3.02 -y
  29. choco install --no-progress curl wget 7zip.portable -y
  30. displayName: Install dependencies
  31. - template: install-neko-snapshot.yaml
  32. parameters:
  33. ${{ if eq(parameters.arch, '64') }}:
  34. platform: windows64
  35. ${{ if eq(parameters.arch, '32') }}:
  36. platform: windows
  37. - powershell: |
  38. Set-PSDebug -Trace 1
  39. curl.exe -fsSL -o cygwin-setup.exe --retry 3 $(CYGWIN_SETUP)
  40. 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 mingw64-$(MINGW_ARCH)-zlib -P mingw64-$(MINGW_ARCH)-gcc-core -P mingw64-$(MINGW_ARCH)-pcre" -Wait
  41. 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
  42. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'echo "$OLDPWD"')
  43. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && tar -xf opam.tar.xz')
  44. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && bash opam$(ARCH)/install.sh')
  45. & "$(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')
  46. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam update --yes 2>&1')
  47. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam pin add haxe . --kind=path --no-action --yes 2>&1')
  48. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam install haxe --deps-only --yes 2>&1')
  49. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'opam list')
  50. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'ocamlopt -v')
  51. displayName: Install OCaml and OCaml libraries
  52. - powershell: Write-Host "##vso[task.prependpath]${env:CYG_ROOT}/usr/$(MINGW_ARCH)-w64-mingw32/sys-root/mingw/bin"
  53. displayName: Expose mingw dll files
  54. - powershell: |
  55. Set-PSDebug -Trace 1
  56. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win -j`nproc` haxe 2>&1')
  57. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && opam config exec -- make -s -f Makefile.win haxelib 2>&1')
  58. & "$(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')
  59. dir out
  60. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxe.exe')
  61. & "$(CYG_ROOT)/bin/bash.exe" @('-lc', 'cd "$OLDPWD" && cygcheck ./haxelib.exe')
  62. displayName: Build Haxe
  63. - task: PublishPipelineArtifact@0
  64. inputs:
  65. artifactName: 'win$(ARCH)Binaries'
  66. targetPath: out