-
-
Notifications
You must be signed in to change notification settings - Fork 265
/
Copy path.cirrus.yml
246 lines (241 loc) · 9.26 KB
/
.cirrus.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
# Installs lit, clones the git submodules, builds LDC and the test
# runners and runs the tests.
# Requires env variables CI_ARCH, CI_OS, EXTRA_CMAKE_FLAGS and PARALLELISM.
common_steps_template: &COMMON_STEPS_TEMPLATE
install_lit_script: |
# Install lit
rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED # required for Ubuntu 24.04
python3 -m pip install --user lit
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
clone_submodules_script: |
cd $CIRRUS_WORKING_DIR
git submodule update --init --depth $CIRRUS_CLONE_DEPTH
build_script: |
# Build LDC & LDC D unittests & defaultlib unittest runners
cmake --version
ninja --version
cd $CIRRUS_WORKING_DIR/..
installDir=$PWD/install
mkdir build
cd build
IFS=$'\n' extraFlags=( $(xargs -n1 <<<"$EXTRA_CMAKE_FLAGS") )
cmake -G Ninja $CIRRUS_WORKING_DIR \
-DCMAKE_BUILD_TYPE=Release \
-DD_COMPILER=$PWD/../host-ldc/bin/ldmd2 \
-DCMAKE_INSTALL_PREFIX=$installDir \
-DINCLUDE_INSTALL_DIR=$installDir/import \
-DLDC_LINK_MANUALLY=OFF \
"${extraFlags[@]}"
ninja -j$PARALLELISM obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 -version
always:
run_compiler_unittests_script: |
cd $CIRRUS_WORKING_DIR/../build
ctest --output-on-failure -R ldc2-unittest
run_lit_testsuite_script: |
cd $CIRRUS_WORKING_DIR/../build/tests
python3 runlit.py -v -j $PARALLELISM .
run_dmd_testsuite_script: |
cd $CIRRUS_WORKING_DIR/../build
DMD_TESTSUITE_MAKE_ARGS=-j$PARALLELISM ctest -V -R dmd-testsuite
run_defaultlib_tests_script: |
# Run defaultlib unittests & druntime integration tests
cd $CIRRUS_WORKING_DIR/../build
ctest -j$PARALLELISM --output-on-failure -E "dmd-testsuite|ldc2-unittest|lit-tests"
# Performs the extra packaging steps for jobs producing a prebuilt package.
# Requires env variables CI_ARCH, CI_OS, GITHUB_TOKEN and PARALLELISM (and CC for FreeBSD).
packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
# Install LDC & make portable
install_script: |
cd $CIRRUS_WORKING_DIR/..
cd build
ninja install > /dev/null
cd ..
perl -pi -e s?$PWD/install/?%%ldcbinarypath%%/../?g install/etc/ldc2.conf
if [[ "$CI_OS" == "freebsd" ]]; then
perl -pi -e "s?,druntime-ldc\",?,druntime-ldc\", \"-gcc=$CC\",?" install/etc/ldc2.conf
fi
cp $CIRRUS_WORKING_DIR/{LICENSE,packaging/README} install
cat install/etc/ldc2.conf
# Now rename the installation dir to test portability
mv install installed
# Run hello-world integration test with shared libs
run_shared_libs_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
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
run_lto_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
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
run_dynamic_compile_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
# FreeBSD's LLVM 15 is too old (need LLVM 18+ for dynamic-compile)
if [[ "$CI_OS" != "freebsd" ]]; then
installed/bin/ldc2 -enable-dynamic-compile -run $CIRRUS_WORKING_DIR/tests/dynamiccompile/array.d
fi
# Run ImportC integration test
run_importC_integration_test_script: |
cd $CIRRUS_WORKING_DIR/..
installed/bin/ldc2 -run $CIRRUS_WORKING_DIR/tests/dmd/runnable/test22597.c
# Build & copy dub
build_dub_script: |
cd $CIRRUS_WORKING_DIR/..
export DMD=$PWD/installed/bin/ldmd2
git clone --recursive https://github.com/dlang/dub.git
cd dub
git checkout "$(cat $CIRRUS_WORKING_DIR/packaging/dub_version)"
$DMD -run build.d -O -w -linkonce-templates
cp bin/dub ../installed/bin
../installed/bin/dub --version
# Build & copy dlang tools
build_dlang_tools_script: |
cd $CIRRUS_WORKING_DIR/..
DMD=$PWD/installed/bin/ldmd2
git clone --recursive https://github.com/dlang/tools.git dlang-tools
cd dlang-tools
git checkout "$(cat $CIRRUS_WORKING_DIR/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
# Build & copy reggae
build_reggae_script: |
cd $CIRRUS_WORKING_DIR/..
git clone --recursive https://github.com/kinke/reggae.git
cd reggae
git checkout "$(cat $CIRRUS_WORKING_DIR/packaging/reggae_version)"
# needs rdmd in PATH
PATH="$PWD/../installed/bin:$PATH" DFLAGS="-O -linkonce-templates" ../dub/bin/dub build -v --build-mode=allAtOnce --combined --compiler="$PWD/../installed/bin/ldc2"
cp bin/reggae ../installed/bin
../installed/bin/reggae --version -b ninja
# Pack artifact
pack_artifact_script: |
cd $CIRRUS_WORKING_DIR/..
mkdir artifacts
if [[ "${CIRRUS_TAG:-}" == v* ]]; then
artifactID=${CIRRUS_TAG:1}
else
artifactID=${CIRRUS_CHANGE_IN_REPO:0:8}
fi
artifactName=ldc2-$artifactID-$CI_OS-$CI_ARCH
mv installed $artifactName
chmod -R go=rX $artifactName
tar=tar
if [[ "$CI_OS" == "freebsd" ]]; then
tar=gtar
fi
$tar -cf - --owner=0 --group=0 $artifactName | 7z a artifacts/$artifactName.tar.xz -si -txz -mx9 -mmt$PARALLELISM
ls -lh artifacts/ldc2-*.tar.xz
# Upload to GitHub release (only for commits on the master branch and tags)
upload_to_github_script: |
cd $CIRRUS_WORKING_DIR
if [[ "${CIRRUS_TAG:-}" == v* ]]; then
tools/upload-to-github.sh $CIRRUS_TAG ../artifacts/ldc2-*.tar.xz
elif [[ "${CIRRUS_TAG:-}" = "" && "$CIRRUS_PR" = "" && "$CIRRUS_BRANCH" = "master" ]]; then
tools/upload-to-github.sh CI ../artifacts/ldc2-*.tar.xz
fi
# Installs Ubuntu 20.04+ prerequisites.
# Requires env variables CI_ARCH, EXTRA_APT_PACKAGES and EXTRA_CMAKE_FLAGS.
install_ubuntu_prerequisites_template: &INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
install_prerequisites_script: |
cd $CIRRUS_WORKING_DIR/..
nproc
export DEBIAN_FRONTEND=noninteractive
if [[ "$EXTRA_CMAKE_FLAGS" = *-DMULTILIB?ON* ]]; then
dpkg --add-architecture i386
gcc_pkg="g++-multilib"
libcurl_pkg="libcurl4 libcurl4:i386"
else
gcc_pkg="g++"
libcurl_pkg="libcurl4"
fi
apt-get -q update
apt-get -yq install \
git-core cmake ninja-build $gcc_pkg \
zlib1g-dev $libcurl_pkg curl gdb python3 python3-pip tzdata unzip zip \
$EXTRA_APT_PACKAGES
python3 --version
# Install custom Ninja on x86_64
if [[ "$CI_ARCH" == "x86_64" ]]; then
curl -fL --retry 3 --max-time 60 -O https://github.com/symmetryinvestments/ninja/releases/download/v1.11.1-sym1/ninja-linux.zip
mkdir ninja
unzip ninja-linux.zip -d ninja
rm ninja-linux.zip
ln -sf $PWD/ninja/ninja /usr/bin/ninja
fi
environment:
CIRRUS_CLONE_DEPTH: 50
GITHUB_TOKEN: ENCRYPTED[0955bd48c8d4e5391446fc0149d0719ad0b63df27ec9e6c180a5730a5b10dc7f28f09d1383423db158d21380ee2b022a]
task:
name: Ubuntu rolling x64 shared-libs-only gdmd
container:
image: ubuntu:rolling
cpu: 8
memory: 16G
timeout_in: 15m
environment:
CI_ARCH: x86_64
CI_OS: linux
EXTRA_APT_PACKAGES: "gdmd llvm-dev libclang-common-19-dev lld"
EXTRA_CMAKE_FLAGS: "-DBUILD_SHARED_LIBS=ON -DBUILD_LTO_LIBS=ON -DD_COMPILER=gdmd -DLDC_LINK_MANUALLY=ON"
PARALLELISM: 8
# for gdmd:
LANG: C.UTF-8
<< : *INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
# to get the LTO lit-tests working:
make_lld_the_default_linker_script: |
ln -sf ld.lld /usr/bin/ld
ld --version
disable_tests_script: |
cd $CIRRUS_WORKING_DIR
# FIXME: lsan_interceptors.cpp:82 "((!lsan_init_is_running)) != (0)"
rm tests/sanitizers/lsan_memleak.d
# apparently just fails due to extra linker error output
rm tests/dmd/fail_compilation/needspkgmod.d
<< : *COMMON_STEPS_TEMPLATE
task:
name: FreeBSD 13.3 x64
freebsd_instance:
image_family: freebsd-13-3
cpu: 4
memory: 8G
timeout_in: 60m
environment:
CI_ARCH: x86_64
CI_OS: freebsd
EXTRA_CMAKE_FLAGS: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
PARALLELISM: 4
CC: clang
install_prerequisites_script: |
cd $CIRRUS_WORKING_DIR/..
sysctl -n hw.ncpu
pkg install -y git cmake ninja gmake llvm bash gtar 7-zip ldc
python3 --version
python3 -m ensurepip
clone_submodules_early_script: |
cd $CIRRUS_WORKING_DIR
git submodule update --init --depth $CIRRUS_CLONE_DEPTH
# Build a first LDC as host compiler for the actual build
build_bootstrap_ldc_script: |
cd $CIRRUS_WORKING_DIR/..
mkdir host-ldc
cd host-ldc
cmake -G Ninja $CIRRUS_WORKING_DIR \
-DCMAKE_BUILD_TYPE=Release \
-DD_COMPILER=ldmd2 \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_LTO_LIBS=ON
ninja -j$PARALLELISM
bin/ldc2 -version
<< : *COMMON_STEPS_TEMPLATE
<< : *PACKAGING_STEPS_TEMPLATE