azure-pipelines.yml 4.6 KB

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