azure-pipelines.yml 4.8 KB

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