azure-pipelines.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. trigger:
  2. branches:
  3. include:
  4. - '*'
  5. pr:
  6. branches:
  7. include:
  8. - '*'
  9. jobs:
  10. - job: packages
  11. timeoutInMinutes: 90 # default `60` led to lots of cancelled jobs; use 0 for unlimited (may be undesirable)
  12. strategy:
  13. matrix:
  14. Linux_amd64:
  15. vmImage: 'ubuntu-16.04'
  16. CPU: amd64
  17. Linux_i386:
  18. vmImage: 'ubuntu-16.04'
  19. CPU: i386
  20. OSX_amd64:
  21. vmImage: 'macOS-10.15'
  22. CPU: amd64
  23. OSX_amd64_cpp:
  24. vmImage: 'macOS-10.15'
  25. CPU: amd64
  26. NIM_COMPILE_TO_CPP: true
  27. Windows_amd64:
  28. vmImage: 'windows-2019'
  29. CPU: amd64
  30. Windows_amd64_pkg:
  31. vmImage: 'windows-2019'
  32. CPU: amd64
  33. NIM_TEST_PACKAGES: true
  34. pool:
  35. vmImage: $(vmImage)
  36. workspace:
  37. clean: all
  38. steps:
  39. - bash: git config --global core.autocrlf false
  40. displayName: 'Disable auto conversion to CRLF by git (Windows-only)'
  41. condition: eq(variables['Agent.OS'], 'Windows_NT')
  42. - checkout: self
  43. - bash: git clone --depth 1 https://github.com/nim-lang/csources.git
  44. displayName: 'Checkout csources'
  45. - task: NodeTool@0
  46. inputs:
  47. versionSpec: '8.x'
  48. displayName: 'Install node.js 8.x'
  49. - bash: |
  50. sudo apt-fast update -qq
  51. DEBIAN_FRONTEND='noninteractive' \
  52. sudo apt-fast install --no-install-recommends -yq \
  53. libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg
  54. displayName: 'Install dependencies (amd64 Linux)'
  55. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
  56. - bash: |
  57. sudo dpkg --add-architecture i386
  58. # Downgrade llvm, libgcc and libstdc++:
  59. # - llvm has to be downgraded to have 32bit version installed for sfml.
  60. # - libgcc and libstdc++ have to be downgraded as an optimization to
  61. # prevent the use of the toolchain ppa, which has a terrible download
  62. # speed.
  63. cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
  64. Package: libllvm6.0 libgcc1 libstdc++6
  65. Pin: origin "azure.archive.ubuntu.com"
  66. Pin-Priority: 1001
  67. Package: *
  68. Pin: release o=LP-PPA-ubuntu-toolchain-r-test
  69. Pin-Priority: 100
  70. EOF
  71. sudo apt-fast update -qq
  72. # `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get:
  73. # `could not load: libffi.so` during dynamic loading.
  74. DEBIAN_FRONTEND='noninteractive' \
  75. sudo apt-fast install --no-install-recommends --allow-downgrades -yq \
  76. g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \
  77. libsdl1.2-dev:i386 libsfml-dev:i386 libglib2.0-dev:i386 libffi-dev:i386
  78. cat << EOF > bin/gcc
  79. #!/bin/bash
  80. exec $(which gcc) -m32 "\$@"
  81. EOF
  82. cat << EOF > bin/g++
  83. #!/bin/bash
  84. exec $(which g++) -m32 "\$@"
  85. EOF
  86. chmod 755 bin/gcc
  87. chmod 755 bin/g++
  88. displayName: 'Install dependencies (i386 Linux)'
  89. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
  90. - bash: brew install boehmgc make sfml
  91. displayName: 'Install dependencies (OSX)'
  92. condition: eq(variables['Agent.OS'], 'Darwin')
  93. - bash: |
  94. mkdir dist
  95. curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
  96. curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
  97. 7z x dist/mingw64.7z -odist
  98. 7z x dist/dlls.zip -obin
  99. echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
  100. displayName: 'Install dependencies (Windows)'
  101. condition: eq(variables['Agent.OS'], 'Windows_NT')
  102. - bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
  103. displayName: 'Add build binaries to PATH'
  104. - bash: |
  105. echo 'PATH:' "$PATH"
  106. echo '##[section]gcc version'
  107. gcc -v
  108. echo '##[section]nodejs version'
  109. node -v
  110. echo '##[section]make version'
  111. make -v
  112. displayName: 'System information'
  113. - bash: |
  114. ncpu=
  115. case '$(Agent.OS)' in
  116. 'Linux')
  117. ncpu=$(nproc)
  118. ;;
  119. 'Darwin')
  120. ncpu=$(sysctl -n hw.ncpu)
  121. ;;
  122. 'Windows_NT')
  123. ncpu=$NUMBER_OF_PROCESSORS
  124. ;;
  125. esac
  126. [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
  127. make -C csources -j $ncpu CC=gcc ucpu=$(CPU)
  128. displayName: 'Build csources'
  129. - bash: nim c koch
  130. displayName: 'Build koch'
  131. # set result to omit the "bash exited with error code '1'" message
  132. - bash: |
  133. ./koch runCI || echo '##vso[task.complete result=Failed]'
  134. displayName: 'Run CI'
  135. env:
  136. SYSTEM_ACCESSTOKEN: $(System.AccessToken)