azure-pipelines.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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_batch0_3:
  28. vmImage: 'windows-2019'
  29. CPU: amd64
  30. # see also: `NIM_TEST_PACKAGES`
  31. NIM_TESTAMENT_BATCH: "0_3"
  32. Windows_amd64_batch1_3:
  33. vmImage: 'windows-2019'
  34. CPU: amd64
  35. NIM_TESTAMENT_BATCH: "1_3"
  36. Windows_amd64_batch2_3:
  37. vmImage: 'windows-2019'
  38. CPU: amd64
  39. NIM_TESTAMENT_BATCH: "2_3"
  40. pool:
  41. vmImage: $(vmImage)
  42. workspace:
  43. clean: all
  44. steps:
  45. - bash: git config --global core.autocrlf false
  46. displayName: 'Disable auto conversion to CRLF by git (Windows-only)'
  47. condition: eq(variables['Agent.OS'], 'Windows_NT')
  48. - checkout: self
  49. fetchDepth: 1
  50. - bash: git clone --depth 1 https://github.com/nim-lang/csources
  51. displayName: 'Checkout Nim csources'
  52. - task: NodeTool@0
  53. inputs:
  54. versionSpec: '12.x'
  55. displayName: 'Install node.js 12.x'
  56. - bash: |
  57. sudo apt-fast update -qq
  58. DEBIAN_FRONTEND='noninteractive' \
  59. sudo apt-fast install --no-install-recommends -yq \
  60. libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg
  61. displayName: 'Install dependencies (amd64 Linux)'
  62. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
  63. - bash: |
  64. sudo dpkg --add-architecture i386
  65. # Downgrade llvm:
  66. # - llvm has to be downgraded to have 32bit version installed for sfml.
  67. cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
  68. Package: libllvm6.0
  69. Pin: origin "azure.archive.ubuntu.com"
  70. Pin-Priority: 1001
  71. EOF
  72. sudo apt-fast update -qq
  73. # `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get:
  74. # `could not load: libffi.so` during dynamic loading.
  75. DEBIAN_FRONTEND='noninteractive' \
  76. sudo apt-fast install --no-install-recommends --allow-downgrades -yq \
  77. g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \
  78. libsdl1.2-dev:i386 libsfml-dev:i386 libglib2.0-dev:i386 libffi-dev:i386
  79. cat << EOF > bin/gcc
  80. #!/bin/bash
  81. exec $(which gcc) -m32 "\$@"
  82. EOF
  83. cat << EOF > bin/g++
  84. #!/bin/bash
  85. exec $(which g++) -m32 "\$@"
  86. EOF
  87. chmod 755 bin/gcc
  88. chmod 755 bin/g++
  89. displayName: 'Install dependencies (i386 Linux)'
  90. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
  91. - bash: brew install boehmgc make sfml
  92. displayName: 'Install dependencies (OSX)'
  93. condition: eq(variables['Agent.OS'], 'Darwin')
  94. - bash: |
  95. mkdir dist
  96. curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
  97. curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
  98. 7z x dist/mingw64.7z -odist
  99. 7z x dist/dlls.zip -obin
  100. echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
  101. displayName: 'Install dependencies (Windows)'
  102. condition: eq(variables['Agent.OS'], 'Windows_NT')
  103. - bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
  104. displayName: 'Add build binaries to PATH'
  105. - bash: |
  106. echo 'PATH:' "$PATH"
  107. echo '##[section]gcc version'
  108. gcc -v
  109. echo '##[section]nodejs version'
  110. node -v
  111. echo '##[section]make version'
  112. make -v
  113. displayName: 'System information'
  114. - bash: echo '##vso[task.setvariable variable=csources_version]'"$(git -C csources rev-parse HEAD)"
  115. displayName: 'Get csources version'
  116. - task: Cache@2
  117. inputs:
  118. key: 'csources | "$(Agent.OS)" | $(CPU) | $(csources_version)'
  119. path: csources/bin
  120. displayName: 'Restore built csources'
  121. - bash: |
  122. ncpu=
  123. ext=
  124. case '$(Agent.OS)' in
  125. 'Linux')
  126. ncpu=$(nproc)
  127. ;;
  128. 'Darwin')
  129. ncpu=$(sysctl -n hw.ncpu)
  130. ;;
  131. 'Windows_NT')
  132. ncpu=$NUMBER_OF_PROCESSORS
  133. ext=.exe
  134. ;;
  135. esac
  136. [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
  137. if [[ -x csources/bin/nim$ext ]]; then
  138. echo "Found cached compiler, skipping build"
  139. else
  140. make -C csources -j $ncpu CC=gcc ucpu=$(CPU) koch=no
  141. fi
  142. cp csources/bin/nim$ext bin
  143. displayName: 'Build 1-stage compiler from csources'
  144. - bash: nim c koch
  145. displayName: 'Build koch'
  146. # set result to omit the "bash exited with error code '1'" message
  147. - bash: ./koch runCI || echo '##vso[task.complete result=Failed]'
  148. displayName: 'Run CI'
  149. env:
  150. SYSTEM_ACCESSTOKEN: $(System.AccessToken)