diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4474a78cc3..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -sudo: false -os: linux -language: d -d: dmd-2.071.0 -git: - depth: 1 -install: - - mkdir druntime - - ls -1 | grep -v ^druntime | xargs -I{} mv {} druntime - - git clone --depth=1 https://github.com/dlang/dmd -# Dscanner should be enabled soon -#- git clone https://github.com/Hackerpilot/Dscanner -#- (cd Dscanner && git checkout tags/v0.4.0-alpha.8) -#- (cd Dscanner && git submodule update --init --recursive) -## debug build is faster, but disable 'missing import' messages (missing core from druntime) -#- (cd Dscanner && sed 's/dparse_verbose/StdLoggerDisableWarning/' -i makefile && make githash debug) -## avoid checking it's dscanner's directory -script: - - echo "Checking for trailing whitespace" - - rdmd ./dmd/src/checkwhitespace.d $(find druntime -name '*.d') -# This should be enabled over time -#- echo "Enforce whitespace between statements" -#- (cd druntime && grep -nE "(for|foreach|foreach_reverse|if|while|switch|catch)\(" $(find src -name '*.d'); test $? -eq 1) -#- echo "Enforce whitespace between colon(:) for import statements (doesn't catch everything)" -#- (cd druntime && grep -n 'import [^/,=]*:.*;' $(find src -name '*.d') | grep -vE "import ([^ ]+) :\s"; test $? -eq 1) -#- echo "Enforce Allman style" -#- (cd druntime && grep -nE '(if|for|foreach|foreach_reverse|while|unittest|switch|else|version) .*{$' $(find src -name '*.d'); test $? -eq 1) -#- echo "Running DScanner" -#- (cd druntime && ../Dscanner/dsc --config ../.dscanner.ini --styleCheck src) - # test code coverage - - (cd dmd && make -f posix.mak) - - (cd druntime && TEST_COVERAGE="1" make -f posix.mak unittest-debug) - # ignore stored coverage reports - - rm -r dmd/test/runnable/extra-files - - rm -r druntime/test/coverage/generated -after_success: - - (cd druntime && bash <(curl -s https://codecov.io/bash)) diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..2ef12a63c4 --- /dev/null +++ b/circle.yml @@ -0,0 +1,16 @@ +dependencies: + pre: + - ./circleci.sh install-deps + cache_directories: + - "~/dlang" + +test: + override: + - make -f posix.mak style + - ./circleci.sh coverage: + parallel: true + + post: + # CodeCov gets confused by stored .lst files + - rm -rf test/coverage/generated + - bash <(curl -s https://codecov.io/bash) diff --git a/circleci.sh b/circleci.sh new file mode 100755 index 0000000000..7db45a8e95 --- /dev/null +++ b/circleci.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -uexo pipefail + +HOST_DMD_VER=2.068.2 # same as in dmd/src/posix.mak +CURL_USER_AGENT="CirleCI $(curl --version | head -n 1)" +N=2 + +case $CIRCLE_NODE_INDEX in + 0) MODEL=64 ;; + 1) MODEL=32 ;; +esac + +install_deps() { + if [ $MODEL -eq 32 ]; then + sudo apt-get update + sudo apt-get install g++-multilib + fi + + for i in {0..4}; do + if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 https://dlang.org/install.sh -O; then + break + elif [ $i -ge 4 ]; then + sleep $((1 << $i)) + else + echo 'Failed to download install script' 1>&2 + exit 1 + fi + done + + source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash install.sh dmd-$HOST_DMD_VER --activate)" + $DC --version + env +} + +# clone dmd +clone() { + local url="$1" + local path="$2" + local branch="$3" + for i in {0..4}; do + if git clone --depth=1 --branch "$branch" "$url" "$path"; then + break + elif [ $i -lt 4 ]; then + sleep $((1 << $i)) + else + echo "Failed to clone: ${url}" + exit 1 + fi + done +} + +coverage() { + if [ -n ${CIRCLE_PR_NUMBER:-} ]; then + local base_branch=$(curl -fsSL https://api.github.com/repos/dlang/dmd/pulls/$CIRCLE_PR_NUMBER | jq -r '.base.ref') + else + local base_branch=$CIRCLE_BRANCH + fi + + clone https://github.com/dlang/dmd.git ../dmd $base_branch + + # load environment for bootstrap compiler + source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)" + + # build dmd and druntime + make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD all + make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD dmd.conf + TEST_COVERAGE="1" make -j$N -C . -f posix.mak MODEL=$MODEL unittest-debug +} + +case $1 in + install-deps) install_deps ;; + coverage) coverage ;; +esac diff --git a/posix.mak b/posix.mak index c4c4d95be7..c3ba4ccd9f 100644 --- a/posix.mak +++ b/posix.mak @@ -304,6 +304,11 @@ clean: $(addsuffix /.clean,$(ADDITIONAL_TESTS)) test/%/.clean: test/%/Makefile $(MAKE) -C test/$* clean +# Submission to Druntime are required to conform to the DStyle +# The tests below automate some, but not all parts of the DStyle guidelines. +# See: http://dlang.org/dstyle.html +style: checkwhitespace + .PHONY : auto-tester-build auto-tester-build: target checkwhitespace