azure-pipelines.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. - bash: git clone --depth 1 https://github.com/nim-lang/csources.git
  50. displayName: 'Checkout csources'
  51. - task: NodeTool@0
  52. inputs:
  53. versionSpec: '12.x'
  54. displayName: 'Install node.js 12.x'
  55. - bash: |
  56. sudo apt-fast update -qq
  57. DEBIAN_FRONTEND='noninteractive' \
  58. sudo apt-fast install --no-install-recommends -yq \
  59. libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg
  60. displayName: 'Install dependencies (amd64 Linux)'
  61. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
  62. - bash: |
  63. sudo dpkg --add-architecture i386
  64. # Downgrade llvm, libgcc and libstdc++:
  65. # - llvm has to be downgraded to have 32bit version installed for sfml.
  66. # - libgcc and libstdc++ have to be downgraded as an optimization to
  67. # prevent the use of the toolchain ppa, which has a terrible download
  68. # speed.
  69. cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
  70. Package: libllvm6.0 libgcc1 libstdc++6
  71. Pin: origin "azure.archive.ubuntu.com"
  72. Pin-Priority: 1001
  73. Package: *
  74. Pin: release o=LP-PPA-ubuntu-toolchain-r-test
  75. Pin-Priority: 100
  76. EOF
  77. sudo apt-fast update -qq
  78. # `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get:
  79. # `could not load: libffi.so` during dynamic loading.
  80. DEBIAN_FRONTEND='noninteractive' \
  81. sudo apt-fast install --no-install-recommends --allow-downgrades -yq \
  82. g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \
  83. libsdl1.2-dev:i386 libsfml-dev:i386 libglib2.0-dev:i386 libffi-dev:i386
  84. cat << EOF > bin/gcc
  85. #!/bin/bash
  86. exec $(which gcc) -m32 "\$@"
  87. EOF
  88. cat << EOF > bin/g++
  89. #!/bin/bash
  90. exec $(which g++) -m32 "\$@"
  91. EOF
  92. chmod 755 bin/gcc
  93. chmod 755 bin/g++
  94. displayName: 'Install dependencies (i386 Linux)'
  95. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
  96. - bash: brew install boehmgc make sfml
  97. displayName: 'Install dependencies (OSX)'
  98. condition: eq(variables['Agent.OS'], 'Darwin')
  99. - bash: |
  100. mkdir dist
  101. curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
  102. curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
  103. 7z x dist/mingw64.7z -odist
  104. 7z x dist/dlls.zip -obin
  105. echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
  106. displayName: 'Install dependencies (Windows)'
  107. condition: eq(variables['Agent.OS'], 'Windows_NT')
  108. - bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
  109. displayName: 'Add build binaries to PATH'
  110. - bash: |
  111. echo 'PATH:' "$PATH"
  112. echo '##[section]gcc version'
  113. gcc -v
  114. echo '##[section]nodejs version'
  115. node -v
  116. echo '##[section]make version'
  117. make -v
  118. displayName: 'System information'
  119. - bash: |
  120. ncpu=
  121. case '$(Agent.OS)' in
  122. 'Linux')
  123. ncpu=$(nproc)
  124. ;;
  125. 'Darwin')
  126. ncpu=$(sysctl -n hw.ncpu)
  127. ;;
  128. 'Windows_NT')
  129. ncpu=$NUMBER_OF_PROCESSORS
  130. ;;
  131. esac
  132. [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
  133. make -C csources -j $ncpu CC=gcc ucpu=$(CPU)
  134. displayName: 'Build csources'
  135. - bash: nim c koch
  136. displayName: 'Build koch'
  137. # set result to omit the "bash exited with error code '1'" message
  138. - bash: |
  139. ./koch runCI || echo '##vso[task.complete result=Failed]'
  140. displayName: 'Run CI'
  141. env:
  142. SYSTEM_ACCESSTOKEN: $(System.AccessToken)