/
config.yml
312 lines (310 loc) · 12.4 KB
/
config.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
commonSteps: &commonSteps
steps:
# Each step starts in working dir `<root>/project` (containing the cloned LDC repo).
- run:
name: Install dependencies
command: |
cd ..
if [ "$CI_OS" = "linux" ]; then
export DEBIAN_FRONTEND=noninteractive
dpkg --add-architecture i386
apt-get -q update
apt-get -yq install software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get -q update
apt-get -yq install \
curl git-core g++-6-multilib ninja-build \
libcurl4-openssl-dev libcurl3:i386 \
gdb python-pip unzip zip
echo "export CC=gcc-6" >> $BASH_ENV
echo "export CXX=g++-6" >> $BASH_ENV
# install CMake
curl -L -o cmake-x64.tar.gz https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.tar.gz
mkdir cmake-x64
tar -xf cmake-x64.tar.gz --strip 1 -C cmake-x64
echo "export PATH=$PWD/cmake-x64/bin:$PATH" >> $BASH_ENV
# use ld.gold per default, so that LTO is tested
update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 99
else
# install CMake
curl -L -o cmake-x64.tar.gz https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Darwin-x86_64.tar.gz
mkdir cmake-x64
tar -xf cmake-x64.tar.gz --strip 3 -C cmake-x64
# install Ninja
curl -OL https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
mkdir ninja
tar -xf ninja-mac.zip -C ninja
echo "export PATH=$PWD/cmake-x64/bin:$PWD/ninja:$PATH" >> $BASH_ENV
# install Python pip
curl -OL https://bootstrap.pypa.io/get-pip.py
python get-pip.py
fi
# install lit
pip install --user lit
- checkout
- run:
name: Install LDC-flavoured LLVM
command: |
cd ..
mkdir llvm-$LLVM_VERSION
assertsSuffix=""
if [ -z "$CIRCLE_TAG" ]; then
echo "Using LLVM with enabled assertions"
assertsSuffix="-withAsserts"
fi
curl -L -o llvm.tar.xz https://github.com/ldc-developers/llvm/releases/download/ldc-v$LLVM_VERSION/llvm-$LLVM_VERSION-$CI_OS-x86_64$assertsSuffix.tar.xz
tar -xf llvm.tar.xz --strip 1 -C llvm-$LLVM_VERSION
rm llvm.tar.xz
- run:
name: Install LDC host compiler
command: |
cd ..
curl -L -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-$CI_OS-x86_64.tar.xz
mkdir ldc2-$HOST_LDC_VERSION
tar -xf ldc2.tar.xz --strip 1 -C ldc2-$HOST_LDC_VERSION
rm ldc2.tar.xz
- run:
name: Build bootstrap LDC
command: |
cd ..
# output versions
cmake --version
ninja --version
if [ "$CI_OS" = "linux" ]; then gdb --version; fi
python -c "import lit; lit.main();" --version | head -n 1
# build
HOST_LDMD=$PWD/ldc2-$HOST_LDC_VERSION/bin/ldmd2
mkdir bootstrap
cd bootstrap
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION \
-DD_COMPILER=$HOST_LDMD \
$BOOTSTRAP_CMAKE_FLAGS \
$CIRCLE_WORKING_DIRECTORY
ninja -j3
bin/ldc2 -version
cd ..
- run:
name: Checkout git submodules
command: git submodule update --init
- run:
name: Build bootstrap stdlib
command: |
cd ..
HOST_LDMD=$PWD/ldc2-$HOST_LDC_VERSION/bin/ldmd2
cd bootstrap
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION \
-DBUILD_SHARED_LIBS=OFF \
-DD_COMPILER=$HOST_LDMD \
$BOOTSTRAP_CMAKE_FLAGS \
$CIRCLE_WORKING_DIRECTORY
ninja -j3
cd ..
- run:
name: Build LDC and stdlib unittest runners
command: |
cd ..
LDC_INSTALL_DIR=$PWD/ldc2-x64
HOST_LDMD=$PWD/bootstrap/bin/ldmd2
mkdir ninja-ldc
cd ninja-ldc
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION \
-DCMAKE_INSTALL_PREFIX=$LDC_INSTALL_DIR \
-DINCLUDE_INSTALL_DIR=$LDC_INSTALL_DIR/import \
-DD_COMPILER=$HOST_LDMD \
$EXTRA_CMAKE_FLAGS \
$CIRCLE_WORKING_DIRECTORY
ninja -j2 all all-test-runners
bin/ldc2 -version
cd ..
- run:
name: Build and run LDC D unittests
when: always
command: cd ../ninja-ldc && ctest --output-on-failure -R ldc2-unittest
- run:
name: Run LIT testsuite
when: always
command: |
cd ../ninja-ldc
# Temporarily add LLVM bin dir to PATH, so that e.g. wasm-ld is found.
PATH=$PWD/../llvm-$LLVM_VERSION/bin:$PATH ctest -V -R lit-tests
- run:
name: Run DMD testsuite
when: always
command: |
cd ../ninja-ldc
if [ "$CI_OS" = "osx" ]; then
# FIXME: A few 32-bit tests fail due to output containing linker warnings like:
# ld: warning: could not create compact unwind for __D3std11parallelism16submitAndExecuteFCQBlQBk8TaskPoolMDFZvZv: stack subl instruction is too different from dwarf stack size
rm ../project/tests/d2/dmd-testsuite/runnable/{test13613,statictor,b6400}.d
else
# Circle's RAM disk FS apparently doesn't allow long paths.
rm ../project/tests/d2/dmd-testsuite/compilable/issue17167.sh
fi
DMD_TESTSUITE_MAKE_ARGS=-j3 ctest -V -R dmd-testsuite
- run:
name: Run stdlib unittests
when: always
command: |
cd ../ninja-ldc
if [ "$CI_OS" = "linux" ]; then
# FIXME: Exclude std.process unittests for now.
# CircleCI doesn't throw an expected ProcessException when spawning a
# process in a working dir with 0400 permissions (no search permissions).
ctest -j3 --output-on-failure -E "std\.process|dmd-testsuite|ldc2-unittest|lit-tests"
else
ctest -j3 --output-on-failure -E "dmd-testsuite|ldc2-unittest|lit-tests"
fi
- run:
name: Install LDC
command: |
cd ../ninja-ldc
ninja install
cd ..
LDC_INSTALL_DIR=$PWD/ldc2-x64
perl -pi -e s?$LDC_INSTALL_DIR/?%%ldcbinarypath%%/../?g $LDC_INSTALL_DIR/etc/ldc2.conf
cp project/LICENSE $LDC_INSTALL_DIR
cp project/packaging/README $LDC_INSTALL_DIR
# Now rename the installation dir to test portability.
NEW_LDC_INSTALL_DIR=$PWD/ldc2-install
mv $LDC_INSTALL_DIR $NEW_LDC_INSTALL_DIR
echo "export LDC_INSTALL_DIR=$NEW_LDC_INSTALL_DIR" >> $BASH_ENV
- run:
name: Hello world integration test with shared libs
command: |
cd ..
echo 'void main() { import std.stdio; writeln("Hello world, ", size_t.sizeof * 8, " bits"); }' > hello.d
$LDC_INSTALL_DIR/bin/ldc2 hello.d -m64 -of=hello64 -link-defaultlib-shared
./hello64
$LDC_INSTALL_DIR/bin/ldc2 hello.d -m32 -of=hello32 -link-defaultlib-shared
./hello32
- run:
name: Hello world integration test with LTO
command: |
cd ..
$LDC_INSTALL_DIR/bin/ldc2 hello.d -of=hello_thin -flto=thin -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
./hello_thin
$LDC_INSTALL_DIR/bin/ldc2 hello.d -of=hello_full -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
./hello_full
- run:
name: Dynamic-compile integration test
command: |
cd ..
$LDC_INSTALL_DIR/bin/ldc2 -enable-dynamic-compile -run project/tests/dynamiccompile/array.d
- run:
name: Build dub
command: |
cd ..
export DMD=$LDC_INSTALL_DIR/bin/ldmd2
git clone --recursive https://github.com/dlang/dub.git
cd dub
git checkout "$(cat ../project/packaging/dub_version)"
if [ -z "$CIRCLE_TAG" ]; then
# FIXME: dub is built with `-g -O`, which leads to issue #2361 with enabled
# assertions, at least on Linux. So strip `-g` for untagged builds.
perl -pi -e "s? -g -O ? -O ?g" build.sh
fi
./build.sh
cp bin/dub $LDC_INSTALL_DIR/bin
cd ..
- run:
name: Build dlang tools
command: |
cd ..
git clone --recursive https://github.com/dlang/tools.git
cd tools
make -f posix.mak -j3 install \
DMD=$LDC_INSTALL_DIR/bin/ldmd2 \
DMD_DIR=$PWD/../project/tests/d2 \
DFLAGS="-w -de" \
INSTALL_DIR=$PWD
cp bin/{rdmd,ddemangle,dustmite} $LDC_INSTALL_DIR/bin
cd ..
- run:
name: Pack installation dir
command: |
cd ..
mkdir artifacts
if [ -z "$CIRCLE_TAG" ]; then
artifactBasename="ldc2-${CIRCLE_SHA1:0:8}-$CI_OS-x86_64"
else
artifactBasename="ldc2-${CIRCLE_TAG:1}-$CI_OS-x86_64"
fi
mv $LDC_INSTALL_DIR $artifactBasename
XZ_OPT=-9 tar -cJf artifacts/$artifactBasename.tar.xz $artifactBasename
- run:
name: Pack source dir
command: |
cd ..
if [ "$CI_OS" = "linux" ]; then
if [ -z "$CIRCLE_TAG" ]; then
artifactBasename="ldc-${CIRCLE_SHA1:0:8}-src"
else
artifactBasename="ldc-${CIRCLE_TAG:1}-src"
fi
GZIP=-9 tar -czf artifacts/$artifactBasename.tar.gz --exclude-vcs --transform=s/project/$artifactBasename/ project
tar -xf artifacts/$artifactBasename.tar.gz
zip -r -9 artifacts/$artifactBasename.zip $artifactBasename
fi
- store_artifacts:
path: ../artifacts
- run:
name: Deploy to GitHub CI release
command: |
cd ..
if [[ -n "$CIRCLE_TAG" || ( "$CIRCLE_BRANCH" = "master" && -z "$CIRCLE_PR_NUMBER" ) ]]; then
if [ "$CI_OS" = "linux" ]; then
curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
else
curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2
fi
tar -xf github-release.tar.bz2 --strip 3
cd artifacts
# Note: needs GITHUB_TOKEN environment variable
../github-release upload --user ldc-developers --repo ldc --tag ${CIRCLE_TAG:-CI} --name "$(ls ldc2-*.tar.xz)" --file ldc2-*.tar.xz
if [[ -n "$CIRCLE_TAG" && "$CI_OS" = "linux" ]]; then
../github-release upload --user ldc-developers --repo ldc --tag $CIRCLE_TAG --name "$(ls ldc-*-src.tar.gz)" --file ldc-*-src.tar.gz
../github-release upload --user ldc-developers --repo ldc --tag $CIRCLE_TAG --name "$(ls ldc-*-src.zip)" --file ldc-*-src.zip
fi
fi
version: 2
jobs:
build-linux:
<<: *commonSteps
docker:
- image: ubuntu:14.04
environment:
- CI_OS: linux
- LLVM_VERSION: 7.0.1
- HOST_LDC_VERSION: 1.10.0
- EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DBUILD_LTO_LIBS=ON -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON"
build-osx:
<<: *commonSteps
macos:
xcode: "9.2.0"
environment:
- CI_OS: osx
- MACOSX_DEPLOYMENT_TARGET: 10.8
- USE_LIBCPP: true
- LLVM_VERSION: 7.0.1
- HOST_LDC_VERSION: 1.10.0
- BOOTSTRAP_CMAKE_FLAGS: "-DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS=-lc++"
- EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DBUILD_LTO_LIBS=ON -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS=-lc++"
workflows:
version: 2
build:
jobs:
- build-linux:
# This is required to also trigger the job after pushing a tag.
filters:
tags:
only: /.*/
- build-osx:
filters:
tags:
only: /.*/