azure-pipelines.yml 4.4 KB

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