-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
134 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
PS4="~> " # needed to avoid accidentally generating collapsed output | ||
set -uexo pipefail | ||
|
||
# Builds DMD, DRuntime, Phobos, tools and DUB + creates a "distribution" archive for latter usage. | ||
echo "--- Setting build variables" | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
origin_repo="$(echo "$BUILDKITE_REPO" | sed "s/.*\/\([^\]*\)[.]git/\1/")" | ||
origin_target_branch="$BUILDKITE_PULL_REQUEST_BASE_BRANCH" | ||
if [ -z "$origin_target_branch" ] ; then | ||
origin_target_branch="$BUILDKITE_BRANCH" | ||
fi | ||
echo "origin_target_branch: $origin_target_branch" | ||
|
||
echo "--- Cloning all core repositories" | ||
for dir in dmd druntime phobos tools dub ; do | ||
if [ "$origin_repo" == "$dir" ] ; then | ||
# we have already cloned this repo, so let's use this data | ||
mkdir -p $dir | ||
cp -r $(ls -A | grep -v $dir) $dir | ||
else | ||
branch=$(git ls-remote --exit-code --heads https://github.com/dlang/$dir "${origin_target_branch}" > /dev/null || echo "master") | ||
git clone -b "${branch:-master}" --depth 1 https://github.com/dlang/$dir | ||
fi | ||
done | ||
|
||
for dir in dmd druntime phobos ; do | ||
echo "--- Building $dir" | ||
make -C $dir -f posix.mak AUTO_BOOTSTRAP=1 --jobs=4 | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
PS4="~> " # needed to avoid accidentally generating collapsed output | ||
set -uexo pipefail | ||
|
||
echo "--- Setting build variables" | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
N=2 | ||
MODEL=64 | ||
PIC=1 | ||
|
||
"$DIR/clone_repositories.sh" | ||
|
||
echo "--- Running the testsuite with COVERAGE=1" | ||
case "$REPO_FULL_NAME" in | ||
"https://github.com/dlang/dmd.git") | ||
make -j${N} | ||
# rebuild dmd with coverage enabled | ||
# use the just build dmd as host compiler this time | ||
build_path=generated/linux/release/$MODEL | ||
# `generated` gets cleaned in the next step, so we create another _generated | ||
# The nested folder hierarchy is needed to conform to those specified in | ||
# the generate dmd.conf | ||
mkdir -p _${build_path} | ||
cp $build_path/dmd _${build_path}/host_dmd | ||
cp $build_path/dmd.conf _${build_path} | ||
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd PIC="$PIC" clean | ||
make -j$N -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd ENABLE_COVERAGE=1 ENABLE_WARNINGS=1 PIC="$PIC" | ||
|
||
cp $build_path/dmd _${build_path}/host_dmd_cov | ||
make -j1 -C src -f posix.mak MODEL=$MODEL HOST_DMD=../_${build_path}/host_dmd_cov ENABLE_COVERAGE=1 PIC="$PIC" unittest | ||
make -j1 -C test MODEL=$MODEL ARGS="-O -inline -release" DMD_TEST_COVERAGE=1 PIC="$PIC" | ||
;; | ||
"https://github.com/dlang/druntime.git") | ||
# build dmd and druntime (in debug and release) | ||
make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD BUILD="debug" all | ||
make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD BUILD="release" all | ||
TEST_COVERAGE="1" make -j$N -C . -f posix.mak MODEL=$MODEL unittest-debug | ||
;; | ||
"https://github.com/dlang/phobos.git") | ||
;; | ||
esac | ||
|
||
################################################################################ | ||
# Send to CodeCov | ||
################################################################################ | ||
|
||
wget "https://codecov.io/bash" -O codecov.sh | ||
case "$REPO_FULL_NAME" in | ||
"https://github.com/dlang/dmd.git") | ||
# CodeCov gets confused by lst files which it can't match | ||
rm -rf ../test/runnable/extra-files | ||
cd src # need to run from compilation folder for gcov to find sources | ||
# must match g++ version (on CircleCI `g++` is 4.9 and `gcov` 4.6 :/) | ||
bash ../codecov.sh -p .. -x gcov-4.9 -t "${CODECOV_TOKEN}" | ||
;; | ||
*) | ||
bash codecov.sh -t "${CODECOV_TOKEN}" | ||
;; | ||
esac |