Skip to content

Commit 3cb2967

Browse files
authored
Merge pull request #260 from wilzbach/coverage
Run CodeCov on Buildkite merged-on-behalf-of: Sebastian Wilzbach <[email protected]>
2 parents 1f9dd5e + 9861a4d commit 3cb2967

File tree

4 files changed

+101
-53
lines changed

4 files changed

+101
-53
lines changed

buildkite.sh

Lines changed: 24 additions & 13 deletions
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,6 +11,20 @@ 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"
@@ -36,7 +40,7 @@ cat << 'EOF'
3640
EOF
3741

3842
################################################################################
39-
# Style targets
43+
# Style & coverage targets
4044
# Must run after the 'wait' to avoid blocking the build_distribution step
4145
# (and thus all subsequent project builds)
4246
################################################################################
@@ -47,10 +51,17 @@ case "${BUILDKITE_REPO:-x}" in
4751
"https://github.com/dlang/phobos.git")
4852

4953
cat << 'EOF'
50-
steps:
5154
- command: |
5255
make -f posix.mak style
5356
label: "Style"
57+
58+
- command: |
59+
${LOAD_CI_FOLDER}
60+
./buildkite/test_coverage.sh
61+
label: "Coverage"
62+
retry:
63+
automatic:
64+
limit: 2
5465
EOF
5566
;;
5667
*)

buildkite/build_distribution.sh

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +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-
repositories=(dmd druntime phobos tools dub)
20-
for dir in "${repositories[@]}" ; do
21-
if [ "$origin_repo" == "$dir" ] ; then
22-
# we have already cloned this repo, so let's use this data
23-
mkdir -p "$dir"
24-
for f in ./* ; do
25-
case "$f" in
26-
./.git) ;;
27-
./buildkite) ;;
28-
"./${dir}") ;;
29-
*)
30-
mv "$f" "$dir"
31-
;;
32-
esac
33-
done
34-
fi
35-
done
36-
for dir in "${repositories[@]}" ; do
37-
if [ "$origin_repo" != "$dir" ] ; then
38-
if [ "$origin_target_branch" == "master" ] || [ "$origin_target_branch" == "stable" ] ; then
39-
branch="$origin_target_branch"
40-
else
41-
branch=$(git ls-remote --exit-code --heads "https://github.com/dlang/$dir" "${origin_target_branch}" > /dev/null && echo "$origin_target_branch" || echo "master")
42-
fi
43-
git clone -b "${branch:-master}" --depth 1 "https://github.com/dlang/$dir"
44-
fi
45-
done
46-
47-
for dir in dmd druntime phobos ; do
48-
echo "--- Building $dir"
49-
make -C $dir -f posix.mak AUTO_BOOTSTRAP=1 --jobs=4
50-
done
11+
"$DIR/clone_repositories.sh"
5112

5213
echo "--- Building dub"
5314
cd dub

buildkite/clone_repositories.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
repositories=(dmd druntime phobos tools dub)
20+
for dir in "${repositories[@]}" ; do
21+
if [ "$origin_repo" == "$dir" ] ; then
22+
# we have already cloned this repo, so let's use this data
23+
mkdir -p "$dir"
24+
for f in ./* ; do
25+
case "$f" in
26+
./.git) ;;
27+
./buildkite) ;;
28+
"./${dir}") ;;
29+
*)
30+
mv "$f" "$dir"
31+
;;
32+
esac
33+
done
34+
fi
35+
done
36+
37+
for dir in "${repositories[@]}" ; do
38+
if [ "$origin_repo" != "$dir" ] ; then
39+
if [ "$origin_target_branch" == "master" ] || [ "$origin_target_branch" == "stable" ] ; then
40+
branch="$origin_target_branch"
41+
else
42+
branch=$(git ls-remote --exit-code --heads "https://github.com/dlang/$dir" "${origin_target_branch}" > /dev/null && echo "$origin_target_branch" || echo "master")
43+
fi
44+
git clone -b "${branch:-master}" --depth 1 "https://github.com/dlang/$dir"
45+
fi
46+
done
47+
48+
for dir in dmd druntime phobos ; do
49+
echo "--- Building $dir"
50+
make -C $dir -f posix.mak AUTO_BOOTSTRAP=1 --jobs=4
51+
done

buildkite/test_coverage.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
N=2
10+
MODEL=64
11+
PIC=1
12+
13+
"$DIR/clone_repositories.sh"
14+
15+
echo "--- Running the testsuite with COVERAGE=1"
16+
17+
origin_repo="$(echo "$BUILDKITE_REPO" | sed "s/.*\/\([^\]*\)[.]git/\1/")"
18+
cd "$origin_repo"
19+
20+
if [ -f coverage.sh ] ; then
21+
wget "https://codecov.io/bash" -O codecov.sh
22+
./coverage.sh
23+
else
24+
echo "WARNING: no coverage.sh script found."
25+
fi

0 commit comments

Comments
 (0)