azure-pipelines.yml 4.1 KB

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