azure-pipelines.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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-18.04'
  16. CPU: amd64
  17. Linux_i386:
  18. vmImage: 'ubuntu-18.04'
  19. CPU: i386
  20. OSX_amd64:
  21. vmImage: 'macOS-11'
  22. CPU: amd64
  23. OSX_amd64_cpp:
  24. vmImage: 'macOS-11'
  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-18.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. fetchDepth: 1
  48. - bash: git clone --depth 1 https://github.com/nim-lang/csources_v1 csources
  49. displayName: 'Checkout Nim csources'
  50. - task: NodeTool@0
  51. inputs:
  52. versionSpec: '12.x'
  53. displayName: 'Install node.js 12.x'
  54. - bash: |
  55. sudo apt-fast update -qq
  56. DEBIAN_FRONTEND='noninteractive' \
  57. sudo apt-fast install --no-install-recommends -yq \
  58. libcurl4-openssl-dev libgc-dev libsdl1.2-dev libsfml-dev valgrind libc6-dbg
  59. displayName: 'Install dependencies (amd64 Linux)'
  60. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'amd64'))
  61. - bash: |
  62. sudo dpkg --add-architecture i386
  63. # Downgrade llvm:
  64. # - llvm has to be downgraded to have 32bit version installed for sfml.
  65. cat << EOF | sudo tee /etc/apt/preferences.d/pin-to-rel
  66. Package: libllvm6.0
  67. Pin: origin "azure.archive.ubuntu.com"
  68. Pin-Priority: 1001
  69. EOF
  70. sudo apt-fast update -qq
  71. # `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get:
  72. # `could not load: libffi.so` during dynamic loading.
  73. DEBIAN_FRONTEND='noninteractive' \
  74. sudo apt-fast install --no-install-recommends --allow-downgrades -yq \
  75. g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \
  76. libsdl1.2-dev:i386 libsfml-dev:i386 libglib2.0-dev:i386 libffi-dev:i386
  77. cat << EOF > bin/gcc
  78. #!/bin/bash
  79. exec $(which gcc) -m32 "\$@"
  80. EOF
  81. cat << EOF > bin/g++
  82. #!/bin/bash
  83. exec $(which g++) -m32 "\$@"
  84. EOF
  85. chmod 755 bin/gcc
  86. chmod 755 bin/g++
  87. displayName: 'Install dependencies (i386 Linux)'
  88. condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['CPU'], 'i386'))
  89. - bash: brew install boehmgc make sfml gtk+3
  90. displayName: 'Install dependencies (OSX)'
  91. condition: eq(variables['Agent.OS'], 'Darwin')
  92. - bash: |
  93. mkdir dist
  94. curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
  95. curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
  96. 7z x dist/mingw64.7z -odist
  97. 7z x dist/dlls.zip -obin
  98. echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/dist/mingw64/bin'
  99. displayName: 'Install dependencies (Windows)'
  100. condition: eq(variables['Agent.OS'], 'Windows_NT')
  101. - bash: echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
  102. displayName: 'Add build binaries to PATH'
  103. - bash: |
  104. echo 'PATH:' "$PATH"
  105. echo '##[section]gcc version'
  106. gcc -v
  107. echo '##[section]nodejs version'
  108. node -v
  109. echo '##[section]make version'
  110. make -v
  111. displayName: 'System information'
  112. - bash: echo '##vso[task.setvariable variable=csources_version]'"$(git -C csources rev-parse HEAD)"
  113. displayName: 'Get csources version'
  114. - task: Cache@2
  115. inputs:
  116. key: 'csources | "$(Agent.OS)" | $(CPU) | $(csources_version)'
  117. path: csources/bin
  118. displayName: 'Restore built csources'
  119. - bash: |
  120. ncpu=
  121. ext=
  122. case '$(Agent.OS)' in
  123. 'Linux')
  124. ncpu=$(nproc)
  125. ;;
  126. 'Darwin')
  127. ncpu=$(sysctl -n hw.ncpu)
  128. ;;
  129. 'Windows_NT')
  130. ncpu=$NUMBER_OF_PROCESSORS
  131. ext=.exe
  132. ;;
  133. esac
  134. [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
  135. if [[ -x csources/bin/nim$ext ]]; then
  136. echo "Found cached compiler, skipping build"
  137. else
  138. make -C csources -j $ncpu CC=gcc ucpu=$(CPU) koch=no
  139. fi
  140. cp csources/bin/nim$ext bin
  141. displayName: 'Build 1-stage compiler from csources'
  142. - bash: nim c koch
  143. displayName: 'Build koch'
  144. # set result to omit the "bash exited with error code '1'" message
  145. - bash: ./koch runCI || echo '##vso[task.complete result=Failed]'
  146. displayName: 'Run CI'
  147. env:
  148. SYSTEM_ACCESSTOKEN: $(System.AccessToken)