Skip to content

Commit 1c0c3ad

Browse files
committed
Run bootstrapping tests on Buildkite
1 parent 0bb9743 commit 1c0c3ad

File tree

4 files changed

+102
-29
lines changed

4 files changed

+102
-29
lines changed

buildkite.sh

+45-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
#!/bin/bash
22

3-
cat << 'EOF'
4-
steps:
5-
- command: |
6-
echo "--- Print environment"
7-
uname -a
8-
make --version
9-
\${SHELL} --version || true
10-
c++ --version
11-
ld -v
12-
! command -v gdb &>/dev/null || gdb --version
13-
! dmd --version # ensure that no dmd is the current environment
3+
read -r -d '' LOAD_CI_FOLDER <<- EOM
144
echo "--- Load CI folder"
155
# just to be sure there isn't anything old left
166
git clean -ffdxq .
@@ -21,13 +11,57 @@ steps:
2111
tar xvfz master.tar.gz --strip-components=2 ci-master/buildkite
2212
rm -rf master.tar.gz && popd
2313
fi
14+
EOM
15+
16+
cat << EOF
17+
steps:
18+
- command: |
19+
echo "--- Print environment"
20+
uname -a
21+
make --version
22+
\\\${SHELL} --version || true
23+
c++ --version
24+
ld -v
25+
! command -v gdb &>/dev/null || gdb --version
26+
! dmd --version # ensure that no dmd is the current environment
27+
${LOAD_CI_FOLDER}
2428
./buildkite/build_distribution.sh
2529
label: "Build"
2630
artifact_paths: "distribution.tar.xz"
2731
retry:
2832
automatic:
2933
limit: 2
34+
EOF
3035

36+
################################################################################
37+
# Test bootstrapping with different compilers
38+
################################################################################
39+
40+
case "${BUILDKITE_REPO:-x}" in
41+
"https://github.com/dlang/dmd.git" | \
42+
"https://github.com/dlang/druntime.git" | \
43+
"https://github.com/dlang/phobos.git" | \
44+
"https://github.com/dlang/ci.git")
45+
46+
for line in dmd-64 gdc-64 ldc-64 ; do
47+
# TODO: dmd-32
48+
IFS=- read -r compiler model <<< "$line"
49+
cat << EOF
50+
- command: |
51+
${LOAD_CI_FOLDER}
52+
DMD=$compiler MODEL=$model ./buildkite/test_bootstrap.sh
53+
label: "Bootstrap ($compiler)"
54+
EOF
55+
56+
done
57+
;;
58+
*)
59+
;;
60+
esac
61+
62+
################################################################################
63+
64+
cat << 'EOF'
3165
- wait
3266
EOF
3367

buildkite/build_distribution.sh

+1-18
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,7 @@ echo "--- Setting build variables"
88

99
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010

11-
origin_repo="$(echo "$BUILDKITE_REPO" | sed "s/.*\/\([^\]*\)[.]git/\1/")"
12-
origin_target_branch="$BUILDKITE_PULL_REQUEST_BASE_BRANCH"
13-
if [ -z "$origin_target_branch" ] ; then
14-
origin_target_branch="$BUILDKITE_BRANCH"
15-
fi
16-
echo "origin_target_branch: $origin_target_branch"
17-
18-
echo "--- Cloning all core repositories"
19-
for dir in dmd druntime phobos tools dub ; do
20-
if [ "$origin_repo" == "$dir" ] ; then
21-
# we have already cloned this repo, so let's use this data
22-
mkdir -p $dir
23-
cp -r $(ls -A | grep -v $dir) $dir
24-
else
25-
branch=$(git ls-remote --exit-code --heads https://github.com/dlang/$dir "${origin_target_branch}" > /dev/null || echo "master")
26-
git clone -b "${branch:-master}" --depth 1 https://github.com/dlang/$dir
27-
fi
28-
done
11+
"$DIR/clone_repositories.sh"
2912

3013
for dir in dmd druntime phobos ; do
3114
echo "--- Building $dir"

buildkite/clone_repositories.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
PS4="~> " # needed to avoid accidentally generating collapsed output
4+
set -uexo pipefail
5+
6+
# Builds DMD, DRuntime, Phobos, tools and DUB + creates a "distribution" archive for latter usage.
7+
echo "--- Setting build variables"
8+
9+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10+
11+
origin_repo="$(echo "$BUILDKITE_REPO" | sed "s/.*\/\([^\]*\)[.]git/\1/")"
12+
origin_target_branch="$BUILDKITE_PULL_REQUEST_BASE_BRANCH"
13+
if [ -z "$origin_target_branch" ] ; then
14+
origin_target_branch="$BUILDKITE_BRANCH"
15+
fi
16+
echo "origin_target_branch: $origin_target_branch"
17+
18+
echo "--- Cloning all core repositories"
19+
for dir in dmd druntime phobos tools dub ; do
20+
if [ "$origin_repo" == "$dir" ] ; then
21+
# we have already cloned this repo, so let's use this data
22+
mkdir -p $dir
23+
cp -r $(ls -A | grep -v $dir) $dir
24+
else
25+
branch=$(git ls-remote --exit-code --heads https://github.com/dlang/$dir "${origin_target_branch}" > /dev/null || echo "master")
26+
git clone -b "${branch:-master}" --depth 1 https://github.com/dlang/$dir
27+
fi
28+
done

buildkite/test_bootstrap.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
PS4="~> " # needed to avoid accidentally generating collapsed output
4+
set -uexo pipefail
5+
6+
echo "--- Setting build variables"
7+
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
10+
"$DIR/clone_repositories.sh"
11+
12+
echo "--- Exporting build variables"
13+
14+
export BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-}"
15+
export N=2
16+
export OS_NAME=linux
17+
export FULL_BUILD="${BUILDKITE_PULL_REQUEST+false}"
18+
19+
echo "--- Go to dmd and source ci.sh"
20+
21+
cd dmd
22+
source ci.sh
23+
24+
echo "--- Installing $DMD"
25+
install_d "$DMD" # Source a D compiler
26+
27+
echo "--- Running the testsuite"
28+
testsuite

0 commit comments

Comments
 (0)