From 36001798500e6ddecd597a5694a7ee25ab4e6a64 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 14 Jun 2018 10:44:35 +0200 Subject: Add deploy stage to travis-ci --- scripts/build-otp | 46 +++++++++++++++++++++++++++++++++++++++------- scripts/bundle-otp | 29 +++++++++++++++++++++++++++++ scripts/run-dialyzer | 5 +++-- 3 files changed, 71 insertions(+), 9 deletions(-) create mode 100755 scripts/bundle-otp (limited to 'scripts') diff --git a/scripts/build-otp b/scripts/build-otp index ad0eb07359..abdffe8759 100755 --- a/scripts/build-otp +++ b/scripts/build-otp @@ -1,5 +1,7 @@ #!/bin/bash +set -e + function progress { local file=$1 ls=$(ls -l $file) @@ -14,15 +16,19 @@ function progress { } function do_and_log { + start_time=`date +%s` log="logs/latest-log.$$" echo "" >$log echo -n "$1..." (progress $log) & pid=$! disown - if ./otp_build $2 $3 >$log 2>&1; then + shift + if $* >$log 2>&1; then kill $pid >/dev/null 2>&1 - echo " done." + stop_time=`date +%s` + diff_time=$((stop_time-start_time)) + echo " done, took $diff_time seconds" else kill $pid >/dev/null 2>&1 echo " failed." @@ -36,12 +42,38 @@ if [ ! -d "logs" ]; then mkdir logs fi -do_and_log "Autoconfing" autoconf -do_and_log "Configuring" configure -do_and_log "Building OTP" boot -a +do_and_log "Autoconfing" ./otp_build autoconf +do_and_log "Configuring" ./otp_build configure +do_and_log "Building OTP" ./otp_build boot -a + +if [ "$1" = "release" ]; then + do_and_log "Releasing OTP" ./otp_build release -a +fi -if [ $1 = "release" ]; then - do_and_log "Releasing OTP" release -a +if [ "$1" = "docs" ]; then + DOC_TARGET=${TRAVIS_BRANCH:-release/`erts/autoconf/config.guess`} + DOC_TARGET=${TRAVIS_TAG:-$DOC_TARGET} + TESTROOT=$PWD/$DOC_TARGET do_and_log "Building documentation" make release_docs + do_and_log "Linting documentation" make xmllint + # The code below prepares this build to be used as a deploy to + # github pages for documentation. + if [ "$TRAVIS_PULL_REQUEST" = "false" -a "$TRAVIS_TAG" = "" ]; then + set -x + rm -rf logs + SHA=`git rev-parse --verify HEAD` + DATE=`date -Iseconds` + git clean -xfdq -e $DOC_TARGET + git fetch https://github.com/$TRAVIS_REPO_SLUG gh-pages + git checkout -f FETCH_HEAD + rm -rf _docs/$DOC_TARGET + mv $DOC_TARGET _docs/$DOC_TARGET + echo "---" > _docs/$DOC_TARGET.md + echo "title: $DOC_TARGET" >> _docs/$DOC_TARGET.md + echo "sha: $SHA" >> _docs/$DOC_TARGET.md + echo "generated: $DATE" >> _docs/$DOC_TARGET.md + echo "---" >> _docs/$DOC_TARGET.md + set +x + fi fi exit 0 diff --git a/scripts/bundle-otp b/scripts/bundle-otp new file mode 100755 index 0000000000..f3ff632b63 --- /dev/null +++ b/scripts/bundle-otp @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +OTP_META_FILE=$ERL_TOP/${TRAVIS_TAG}-bundle.txt +OTP_FILE=$ERL_TOP/${TRAVIS_TAG}-bundle.tar.gz + +REPOSITORIES="otp,$TRAVIS_TAG corba,.*" + +mkdir bundle + +for repo in $REPOSITORIES; do + OLD_IFS=$IFS + IFS=',' + set -- $repo + IFS=$OLD_IFS + cd $ERL_TOP/bundle/ + git clone https://github.com/erlang/$1 $1 + cd $1 + echo $1 $2 + TAG=`git tag -l | grep -P "$2" | sort -V | tail -1` + git checkout $TAG + SHA=`git rev-parse --verify HEAD` + rm -rf .git + echo "$1 $TAG $SHA" >> $OTP_META_FILE +done + +cd $ERL_TOP/bundle/ +tar czf $OTP_FILE * diff --git a/scripts/run-dialyzer b/scripts/run-dialyzer index c9da647952..621de3fa65 100755 --- a/scripts/run-dialyzer +++ b/scripts/run-dialyzer @@ -1,16 +1,17 @@ #!/bin/bash set -e +set -x $ERL_TOP/bin/dialyzer --build_plt --apps asn1 compiler crypto dialyzer edoc erts et ftp hipe inets kernel mnesia observer public_key runtime_tools snmp ssh ssl stdlib syntax_tools tftp wx xmerl --statistics $ERL_TOP/bin/dialyzer -n -Wunknown -Wunmatched_returns --apps compiler erts ftp tftp kernel stdlib asn1 crypto dialyzer hipe parsetools public_key runtime_tools sasl tools --statistics $ERL_TOP/bin/dialyzer -n --apps common_test debugger edoc ftp inets mnesia observer ssh ssl syntax_tools tftp wx xmerl --statistics # In travis we don't dialyze everything as it takes too much time -if [ "X$DIALYZE_ALL_APPLICATIONS" = "Xtrue" ]; then +if [ "X$TRAVIS" != "Xtrue" ]; then $ERL_TOP/bin/dialyzer -n -Wunknown -Wunmatched_returns --apps eldap erl_docgen et odbc --statistics $ERL_TOP/bin/dialyzer -n --apps eunit reltool os_mon --statistics # These application are not run always as the currently have dialyzer warnings - # $ERL_TOP/bin/dialyzer -n --apps cosEvent cosEventDomain cosFileTransfer cosNotification cosProperty cosTime cosTransactions diameter megaco orber snmp --statistics + # $ERL_TOP/bin/dialyzer -n --apps diameter megaco snmp --statistics fi -- cgit v1.2.3