forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
220 lines (214 loc) · 8.17 KB
/
.travis.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
os: linux
dist: bionic
arch: arm64
language: d
d: ldc-1.27.1
env:
global:
- LLVM_VERSION: 14.0.3
- CLANG_VERSION: 14.0.0
- OPTS: '"-DBUILD_LTO_LIBS=ON -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -DJITRT_EXTRA_LDFLAGS=-static-libstdc++ -DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64"'
- secure: "WfMv0kOqVU8+SgZUrwgzvzGvFbZvPmeIqrDJ+sotbzEtDeCcMuZmj/+8VuysXzpShXx/FxCoopWpAz30pedES8anGR3ciZruVPPsi22rOR5IBHuSnbamkmF11eQgRaDcj6GvZL7QeWLHBx6EN+C+mQFEVqRrD5avCO/K0RqWTD4="
git:
depth: 50
addons:
apt:
packages:
- gdb
- ninja-build
- p7zip-full
install:
- nproc
- free
# Install lit
- python3 -m pip install --user setuptools wheel
- python3 -m pip install --user lit
- |
set -o pipefail
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
# Download & extract LDC-flavoured LLVM
- |
assertsSuffix=""
if [[ "$TRAVIS_TAG" == "" ]]; then
echo 'Using LLVM with enabled assertions'
assertsSuffix="-withAsserts"
fi
llvm_tag="CI"
if [[ "$LLVM_VERSION" = *.* ]]; then llvm_tag="ldc-v$LLVM_VERSION"; fi
llvm_url="https://github.com/ldc-developers/llvm-project/releases/download/$llvm_tag/llvm-$LLVM_VERSION-linux-aarch64$assertsSuffix.tar.xz"
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz $llvm_url || travis_terminate 1
mkdir -p llvm || travis_terminate 1
tar -xf llvm.tar.xz --strip 1 -C llvm || travis_terminate 1
rm llvm.tar.xz || travis_terminate 1
# Make lld the default linker (possibly with enabled assertions unfortunately)
- sudo ln -sf "$PWD/llvm/bin/ld.lld" /usr/bin/ld
# Download & extract clang
- curl -fL --retry 3 --max-time 300 -o clang.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-$CLANG_VERSION/clang+llvm-$CLANG_VERSION-aarch64-linux-gnu.tar.xz
- mkdir clang
- tar -xf clang.tar.xz --strip 1 -C clang
- rm clang.tar.xz
- export CC="$PWD/clang/bin/clang"
- export CXX="$PWD/clang/bin/clang++"
script:
- unset LD_LIBRARY_PATH
- cmake --version
- ninja --version
# Build bootstrap LDC
- mkdir bootstrap-ldc
- cd bootstrap-ldc
- |
cmake -G Ninja .. \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR="$PWD/../llvm" \
-DBUILD_SHARED_LIBS=OFF \
-DCOMPILE_D_MODULES_SEPARATELY=ON \
-DCOMPILE_ALL_D_FILES_AT_ONCE=OFF \
-DLDC_LINK_MANUALLY=OFF \
-DBUILD_LTO_LIBS=ON \
|| travis_terminate 1
- ninja -j8
- bin/ldc2 -version || travis_terminate 1
- cd ..
# Build mimalloc (object file only)
- curl -fL --retry 3 --max-time 60 -o mimalloc.tar.gz "https://github.com/microsoft/mimalloc/archive/refs/tags/$(cat packaging/mimalloc_version).tar.gz"
- mkdir mimalloc
- tar -xf mimalloc.tar.gz --strip 1 -C mimalloc
- mkdir build-mimalloc
- cd build-mimalloc
- cmake -G Ninja ../mimalloc
- ninja mimalloc-obj
- ls -lh CMakeFiles/mimalloc-obj.dir/src/static.c.o
- cd ..
# Build LDC & LDC D unittests & defaultlib unittest runners
- mkdir build
- cd build
- |
set -x
installDir="$(dirname "$PWD")/install"
cmake -G Ninja .. \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ROOT_DIR="$PWD/../llvm" \
-DD_COMPILER="$PWD/../bootstrap-ldc/bin/ldmd2" \
-DCMAKE_INSTALL_PREFIX="$installDir" \
-DINCLUDE_INSTALL_DIR="$installDir/import" \
-DLDC_LINK_MANUALLY=OFF \
-DALTERNATIVE_MALLOC_O="$PWD/../build-mimalloc/CMakeFiles/mimalloc-obj.dir/src/static.c.o" \
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto" \
-DEXTRA_CXXFLAGS=-flto=full \
$OPTS \
|| travis_terminate 1
set +x
- |
# Work around out-of-memory errors - retry with decreasing jobs
targets='all ldc2-unittest'
ninja -j8 -k0 $targets || \
ninja -j4 -k0 $targets || \
ninja -j1 $targets || travis_terminate 1
targets='all-test-runners'
ninja -j4 -k0 $targets || \
ninja -j2 -k0 $targets || \
ninja -j1 $targets || travis_terminate 1
- bin/ldc2 -version || travis_terminate 1
# Run LDC D unittests
- ctest --output-on-failure -R "ldc2-unittest"
# Run LIT testsuite
# FIXME: the following tests fail
- rm ../tests/debuginfo/nested_gdb.d
- rm ../tests/sanitizers/fuzz_basic.d
# FIXME: the following 2 have regressed with LLVM 13
- rm ../tests/sanitizers/msan_noerror.d
- rm ../tests/sanitizers/msan_uninitialized.d
- ctest -V -R "lit-tests"
# Run DMD testsuite
- DMD_TESTSUITE_MAKE_ARGS="-j8" ctest -V -R "dmd-testsuite"
# Run defaultlib unittests & druntime integration tests
# FIXME:
# * don't exclude hanging core.thread.fiber & druntime-test-gc (probably concurrent-GC tests)
# * don't ignore errors
- ctest -j8 --output-on-failure -E "dmd-testsuite|lit-tests|ldc2-unittest|^core.thread.fiber($|-)|^druntime-test-gc" || true
# Terminate the job if there were failures
- if [[ "$TRAVIS_TEST_RESULT" != "0" ]]; then travis_terminate 1; fi
# Install LDC & make portable
- ninja install > /dev/null
- cd ..
- perl -pi -e "s?$PWD/install/?%%ldcbinarypath%%/../?g" install/etc/ldc2.conf
- cat install/etc/ldc2.conf
- cp LICENSE install
- cp packaging/README install
# Now rename the installation dir to test portability
- mv install installed
# Run hello-world integration test with shared libs
- echo 'void main() { import std.stdio; writefln("Hello world, %d bits", size_t.sizeof * 8); }' > hello.d
- installed/bin/ldc2 hello.d -of=hello -link-defaultlib-shared
- ./hello
# Run hello-world integration test with LTO
- installed/bin/ldc2 hello.d -of=hello_thin -flto=thin -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
- ./hello_thin
- installed/bin/ldc2 hello.d -of=hello_full -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto
- ./hello_full
# Run dynamic-compile integration test
# FIXME: disabled since LLVM 12, needs https://github.com/ldc-developers/ldc/pull/3184
#- installed/bin/ldc2 -enable-dynamic-compile -run tests/dynamiccompile/array.d
# Run ImportC integration test
- installed/bin/ldc2 -run tests/dmd/runnable/test22597.c
# Build & copy dub
- export DMD="$PWD/installed/bin/ldmd2"
- git clone --recursive https://github.com/dlang/dub.git
- cd dub
- git checkout "$(cat ../packaging/dub_version)"
- $DMD -run build.d -O -w -linkonce-templates
- cp bin/dub ../installed/bin
- cd ..
- installed/bin/dub --version
# Build & copy dlang tools
- git clone --recursive https://github.com/dlang/tools.git dlang-tools
- cd dlang-tools
- git checkout "$(cat ../packaging/dlang-tools_version)"
- mkdir bin
- $DMD -w -de -dip1000 rdmd.d -of=bin/rdmd
- $DMD -w -de -dip1000 ddemangle.d -of=bin/ddemangle
- $DMD -w -de -dip1000 DustMite/dustmite.d DustMite/splitter.d DustMite/polyhash.d -of=bin/dustmite
- cp bin/{rdmd,ddemangle,dustmite} ../installed/bin
- cd ..
# Build & copy reggae
- git clone --recursive https://github.com/atilaneves/reggae.git
- cd reggae
- git checkout "$(cat ../packaging/reggae_version)"
- DFLAGS="-O -linkonce-templates" ../installed/bin/dub build -v --build-mode=allAtOnce --combined
- cp bin/reggae ../installed/bin
- cd ..
- installed/bin/reggae --version -b ninja
# Pack installation dir
- |
if [[ "${TRAVIS_TAG:-}" == v* ]]; then
artifactID=${TRAVIS_TAG:1}
else
artifactID=${TRAVIS_COMMIT:0:8}
fi
artifactName=ldc2-$artifactID-linux-aarch64
mv installed $artifactName || travis_terminate 1
artifact=$artifactName.tar.xz
tar -cf - $artifactName | 7za a $artifact -si -txz -mx9 -mmt8 || travis_terminate 1
ls -lh $artifact || travis_terminate 1
# Upload to GitHub release (only for commits on the master branch and tags)
- |
if [[ "$TRAVIS_TEST_RESULT" == "0" ]]; then
if [[ "${TRAVIS_TAG:-}" == v* ]]; then
tools/upload-to-github.sh $TRAVIS_TAG ldc2-*.tar.xz || travis_terminate 1
elif [[ "${TRAVIS_TAG:-}" = "" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" = "master" ]]; then
tools/upload-to-github.sh CI ldc2-*.tar.xz || travis_terminate 1
fi
fi
notifications:
email:
recipients:
on_success: never
on_failure: change
irc:
channels:
- "irc.freenode.org#ldc"
on_success: always
on_failure: always
use_notice: false
skip_join: true