forked from mratsim/constantine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
293 lines (264 loc) · 8.87 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
strategy:
maxParallel: 10
matrix:
# TODO: Broken by OpenSSL not found for nimble
# https://github.com/nim-lang/Nim/blob/bf320ed172f74f60fd274338e82bdc9ce3520dd9/lib/wrappers/openssl.nim#L61
# could not load: (libcrypto-1_1|libeay32).dll
# (bad format; library may be wrong architecture)
# Windows_devel_32bit:
# VM: 'windows-latest'
# UCPU: i686
# CHANNEL: devel
# TEST_LANG: c
Windows_stable_noasm_64bit:
VM: 'windows-latest'
UCPU: amd64
CHANNEL: stable
TEST_LANG: c
BACKEND: NO_ASM
Windows_cpp_stable_noasm_64bit:
VM: 'windows-latest'
UCPU: amd64
CHANNEL: stable
TEST_LANG: cpp
BACKEND: NO_ASM
Linux_stable_noasm_64bit:
VM: 'ubuntu-18.04'
UCPU: amd64
CHANNEL: stable
TEST_LANG: c
BACKEND: NO_ASM
Linux_cpp_stable_noasm_64bit:
VM: 'ubuntu-18.04'
UCPU: amd64
CHANNEL: stable
TEST_LANG: cpp
BACKEND: NO_ASM
# Deactivated for now, this is cross-compilation and tricky to get right
# Linux_devel_32bit:
# VM: 'ubuntu-16.04'
# UCPU: i686
# CHANNEL: devel
# TEST_LANG: c
MacOS_stable_noasm_64bit:
VM: 'macOS-10.15'
UCPU: amd64
CHANNEL: stable
TEST_LANG: c
BACKEND: NO_ASM
# -------------------------------
# No assembly for windows
# Windows_devel_64bit:
# VM: 'windows-latest'
# UCPU: amd64
# CHANNEL: stable
# TEST_LANG: c
# BACKEND: ASM
# Windows_cpp_devel_64bit:
# VM: 'windows-latest'
# UCPU: amd64
# CHANNEL: stable
# TEST_LANG: cpp
# BACKEND: ASM
Linux_stable_asm_64bit:
VM: 'ubuntu-18.04'
UCPU: amd64
CHANNEL: stable
TEST_LANG: c
BACKEND: ASM
Linux_cpp_stable_asm_64bit:
VM: 'ubuntu-18.04'
UCPU: amd64
CHANNEL: stable
TEST_LANG: cpp
BACKEND: ASM
MacOS_stable_asm_64bit:
VM: 'macOS-10.15'
UCPU: amd64
CHANNEL: stable
TEST_LANG: c
BACKEND: ASM
pool:
vmImage: $(VM)
steps:
- task: CacheBeta@1
displayName: 'cache Nim binaries'
inputs:
key: NimBinaries | $(Agent.OS) | $(CHANNEL) | $(UCPU)
path: NimBinaries
- task: CacheBeta@1
displayName: 'cache MinGW-w64'
inputs:
key: mingwCache | 8_1_0 | $(UCPU)
path: mingwCache
condition: eq(variables['Agent.OS'], 'Windows_NT')
- powershell: |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
displayName: 'long path support'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- bash: |
echo "PATH=${PATH}"
set -e
echo "Installing MinGW-w64"
if [[ $UCPU == "i686" ]]; then
MINGW_FILE="i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z"
MINGW_URL="https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/${MINGW_FILE}"
MINGW_DIR="mingw32"
else
MINGW_FILE="x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z"
MINGW_URL="https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/${MINGW_FILE}"
MINGW_DIR="mingw64"
fi
mkdir -p mingwCache
pushd mingwCache
if [[ ! -e "$MINGW_FILE" ]]; then
rm -f *.7z
curl -OLsS "$MINGW_URL"
fi
7z x -y -bd "$MINGW_FILE" >/dev/null
mkdir -p /c/custom
mv "$MINGW_DIR" /c/custom/
popd
# Workaround https://developercommunity.visualstudio.com/content/problem/891929/windows-2019-cygheap-base-mismatch-detected-git-ba.html
echo "##vso[task.prependpath]/usr/bin"
echo "##vso[task.prependpath]/mingw64/bin"
echo "##vso[task.setvariable variable=MINGW_DIR;]$MINGW_DIR"
displayName: 'Install dependencies (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- powershell: |
# export custom mingw PATH to other tasks
echo "##vso[task.prependpath]c:\custom\$(MINGW_DIR)\bin"
displayName: 'Mingw PATH (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- bash: |
echo "PATH=${PATH}"
export ncpu=
case '$(Agent.OS)' in
'Linux')
ncpu=$(nproc)
;;
'Darwin')
ncpu=$(sysctl -n hw.ncpu)
;;
'Windows_NT')
ncpu=$NUMBER_OF_PROCESSORS
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
echo "Found ${ncpu} cores"
echo "##vso[task.setvariable variable=ncpu;]$ncpu"
displayName: 'Detecting number of cores'
- bash: |
sudo dpkg --add-architecture i386
sudo apt-fast update -qq
# `:i386` (e.g. in `libffi-dev:i386`) is needed otherwise you may get:
# `could not load: libffi.so` during dynamic loading.
DEBIAN_FRONTEND='noninteractive' \
sudo apt-fast install --no-install-recommends --allow-downgrades -yq \
g++-multilib gcc-multilib libcurl4-openssl-dev:i386 libgc-dev:i386 \
libffi-dev:i386
mkdir -p bin
cat << EOF > bin/gcc
#!/bin/bash
exec $(which gcc) -m32 "\$@"
EOF
cat << EOF > bin/g++
#!/bin/bash
exec $(which g++) -m32 "\$@"
EOF
chmod 755 bin/gcc
chmod 755 bin/g++
# Add to path
echo '##vso[task.prependpath]$(System.DefaultWorkingDirectory)/bin'
displayName: 'Install dependencies (i386 Linux)'
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['UCPU'], 'i686'))
- bash: |
echo "PATH=${PATH}"
gcc -v
export ucpu=${UCPU}
if [ "${CHANNEL}" = stable ]; then
BRANCH="v$(curl https://nim-lang.org/channels/stable)"
else
BRANCH="${CHANNEL}"
fi
mkdir -p NimBinaries
pushd NimBinaries
if [ ! -x "nim-${CHANNEL}/bin/nim" ]; then
git clone -b "${BRANCH}" https://github.com/nim-lang/nim "nim-${CHANNEL}/"
pushd "nim-${CHANNEL}"
git clone --depth 1 https://github.com/nim-lang/csources csources/
pushd csources
make -j $ncpu ucpu=${UCPU} CC=gcc
popd
rm -rf csources
bin/nim c koch
./koch boot -d:release
./koch tools
else
pushd "nim-${CHANNEL}"
git fetch origin "${BRANCH}"
if [[ $(git merge FETCH_HEAD | grep -c "Already up to date.") -ne 1 ]]; then
bin/nim c koch
./koch boot -d:release
./koch tools
fi
fi
popd # exit nim-${CHANNEL}
popd # exit NimBinaries
displayName: 'Building Nim'
# https://forum.nim-lang.org/t/7494
- powershell: |
bitsadmin.exe /rawreturn /transfer "cURL-certicates" /priority FOREGROUND https://curl.se/ca/cacert.pem $pwd\NimBinaries\nim-$(CHANNEL)\bin\cacert.pem
displayName: 'cURL certificates (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- powershell: |
echo "##vso[task.prependpath]$pwd\NimBinaries\nim-$(CHANNEL)\bin"
displayName: 'Set env variable (Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- bash: |
echo "##vso[task.prependpath]$PWD/NimBinaries/nim-${CHANNEL}/bin"
displayName: 'Set env variable (Posix)'
condition: ne(variables['Agent.OS'], 'Windows_NT')
# GMP is preinstalled on Azure
# - bash: |
# echo "PATH=${PATH}"
# sudo apt-get install libgmp-dev
# displayName: 'Downloading GMP (Linux)'
# condition: eq(variables['Agent.OS'], 'Linux')
#
# - bash: |
# echo "PATH=${PATH}"
# brew install gmp
# displayName: 'Downloading GMP (MacOS)'
# condition: eq(variables['Agent.OS'], 'Darwin')
- bash: |
echo "PATH=${PATH}"
sudo apt-get install libgmp-dev
displayName: 'Downloading GMP (Linux 32-bit)'
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['UCPU'], 'i686'))
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
- bash: |
echo "PATH=${PATH}"
nimble refresh
nimble install -y gmp jsony
displayName: 'Installing package and testing dependencies'
- bash: |
echo "PATH=${PATH}"
export ucpu=${UCPU}
nimble test_parallel
displayName: 'Testing Constantine with Assembler and with GMP'
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), eq(variables['BACKEND'], 'ASM'))
- bash: |
echo "PATH=${PATH}"
export ucpu=${UCPU}
nimble test_parallel_no_assembler
displayName: 'Testing Constantine without Assembler and with GMP'
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), eq(variables['BACKEND'], 'NO_ASM'))
- bash: |
echo "PATH=${PATH}"
export ucpu=${UCPU}
nimble test_no_gmp
displayName: 'Testing the package (without GMP and ASM on Windows)'
condition: eq(variables['Agent.OS'], 'Windows_NT')