aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml16
-rwxr-xr-xdist/linux/buildtest.sh31
-rwxr-xr-xdist/linux/docker-buildtest.sh66
-rw-r--r--dist/linux/docker/build-fedora26+mcode5
-rw-r--r--dist/linux/docker/build-stretch+mcode7
-rw-r--r--dist/linux/docker/build-ubuntu14+llvm-3.87
-rw-r--r--dist/linux/docker/build-ubuntu14+mcode7
-rwxr-xr-xdist/linux/travis-ci.sh92
-rw-r--r--dist/linux/travis-utils.sh22
9 files changed, 114 insertions, 139 deletions
diff --git a/.travis.yml b/.travis.yml
index 39247f189..f18d0cb71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,22 @@ matrix:
dist: trusty
sudo: required
services: docker
+ env: DOCKER_IMAGE=stretch+mcode
+ - os: linux
+ dist: trusty
+ sudo: required
+ services: docker
+ env: DOCKER_IMAGE=ubuntu14+mcode
+ - os: linux
+ dist: trusty
+ sudo: required
+ services: docker
+ env: DOCKER_IMAGE=ubuntu14+llvm-3.8
+ - os: linux
+ dist: trusty
+ sudo: required
+ services: docker
+ env: DOCKER_IMAGE=fedora26+mcode
- os: osx
osx_image: xcode7.3
cache:
diff --git a/dist/linux/buildtest.sh b/dist/linux/buildtest.sh
index b6d654dee..a9116e4eb 100755
--- a/dist/linux/buildtest.sh
+++ b/dist/linux/buildtest.sh
@@ -1,11 +1,17 @@
-#! /bin/sh
+#! /bin/bash
. dist/ansi_color.sh
disable_color
+echo "$0" "$@"
+
# Stop in case of error
set -e
+. dist/linux/travis-utils.sh
+
+rm -f build_ok
+
# Transform long options to short ones
for arg in "$@"; do
shift
@@ -33,7 +39,7 @@ done
#---
-printf "$ANSI_BLUE[$TASK| GHDL] Prepare $(pwd) $ANSI_NOCOLOR\n"
+printf "$ANSI_YELLOW[Prepare] $(pwd) $ANSI_NOCOLOR\n"
CDIR=$(pwd)
prefix="$CDIR/install-$BLD"
mkdir "$prefix"
@@ -43,14 +49,14 @@ cd "build-$BLD"
#--- Env
echo "travis_fold:start:env.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL] Environment $ANSI_NOCOLOR\n"
+printf "$ANSI_YELLOW[Info] Environment $ANSI_NOCOLOR\n"
env
echo "travis_fold:end:env.$TASK"
#--- Configure
echo "travis_fold:start:configure.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL - build] Configure $ANSI_NOCOLOR\n"
+printf "$ANSI_YELLOW[GHDL] Configure $ANSI_NOCOLOR\n"
case "$BLD" in
mcode)
config_opts="" ;;
@@ -74,12 +80,14 @@ echo "travis_fold:end:configure.$TASK"
#--- make
echo "travis_fold:start:make.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL - build] Make $ANSI_NOCOLOR\n"
+travis_time_start
+printf "$ANSI_YELLOW[GHDL] Make $ANSI_NOCOLOR\n"
make
+travis_time_finish
echo "travis_fold:end:make.$TASK"
echo "travis_fold:start:install.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL - build] Install $ANSI_NOCOLOR\n"
+printf "$ANSI_YELLOW[GHDL] Install $ANSI_NOCOLOR\n"
make install
cd ..
echo "travis_fold:end:install.$TASK"
@@ -87,7 +95,7 @@ echo "travis_fold:end:install.$TASK"
#--- package
echo "travis_fold:start:tar.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL] Create package $ANSI_DARKCYAN$PKG_FILE $ANSI_NOCOLOR\n"
+printf "$ANSI_YELLOW[GHDL] Create package $ANSI_DARKCYAN$PKG_FILE $ANSI_NOCOLOR\n"
tar -zcvf "$PKG_FILE" -C "$prefix" .
echo "travis_fold:end:tar.$TASK"
@@ -99,7 +107,8 @@ cd testsuite
failures=""
echo "travis_fold:start:tests.gna.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL - test] gna $ANSI_NOCOLOR\n"
+travis_time_start
+printf "$ANSI_YELLOW[Test] gna $ANSI_NOCOLOR\n"
cd gna
dirs=`./testsuite.sh --list-tests`
for d in $dirs; do
@@ -117,11 +126,13 @@ for d in $dirs; do
[ "$failures" = "" ] || break
done
cd ..
+travis_time_finish
echo "travis_fold:end:tests.gna.$TASK"
[ "$failures" = "" ] || exit 1
echo "travis_fold:start:tests.vests.$TASK"
-printf "$ANSI_BLUE[$TASK| GHDL - test] vests $ANSI_NOCOLOR\n"
+travis_time_start
+printf "$ANSI_YELLOW[Test] vests $ANSI_NOCOLOR\n"
cd vests
if ./testsuite.sh > vests.log 2>&1 ; then
echo "${ANSI_GREEN}Vests is OK$ANSI_NOCOLOR"
@@ -132,6 +143,7 @@ else
failures=vests
fi
cd ..
+travis_time_finish
echo "travis_fold:end:tests.vests.$TASK"
[ "$failures" = "" ] || exit 1
@@ -142,3 +154,4 @@ cd ..
# Do not remove this line, and don't write anything below, since it is used to identify successful builds
echo "[$TASK|SUCCESSFUL]"
+touch build_ok
diff --git a/dist/linux/docker-buildtest.sh b/dist/linux/docker-buildtest.sh
deleted file mode 100755
index 270b9343d..000000000
--- a/dist/linux/docker-buildtest.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#! /bin/sh
-
-. dist/ansi_color.sh
-disable_color
-
-# Stop in case of error
-set -e
-
-# Transform long options to short ones
-for arg in "$@"; do
- shift
- case "$arg" in
- "--color"|"-color") set -- "$@" "-c";;
- "--grab"|"-grab") set -- "$@" "-g";;
- "--image"|"-image") set -- "$@" "-i";;
- "--build"|"-build") set -- "$@" "-b";;
- "--file"|"-file") set -- "$@" "-f";;
- "--taskid"|"-taskid") set -- "$@" "-t";;
- *) set -- "$@" "$arg";;
- esac
-done
-# Parse args
-while getopts ":i:b:f:t:cg" opt; do
- case $opt in
- c) enable_color;;
- g) GRAB_SRCS=1;;
- i) DOCKER_IMG=$OPTARG;;
- b) BLD=$OPTARG ;;
- f) PKG_FILE=$OPTARG;;
- t) TASK=$OPTARG;;
- \?) printf "$ANSI_RED[BUILD] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2
- exit 1 ;;
- :) printf "$ANSI_RED[BUILD] Option -$OPTARG requires an argument $ANSI_NOCOLOR\n" >&2
- exit 1 ;;
- esac
-done
-
-#---
-
-printf "$ANSI_YELLOW[$TASK| BUILD] Docker pull $DOCKER_IMG $ANSI_NOCOLOR\n"
-docker pull "$DOCKER_IMG" > /dev/null 2>&1
-
-#---
-
-printf "$ANSI_YELLOW[$TASK| BUILD] Docker run $DOCKER_IMG $BLD $PKG_FILE $ANSI_NOCOLOR\n"
-
-if [ -n "$GRAB_SRCS" ]; then
-
- printf "$ANSI_YELLOW[$TASK| BUILD] Grab sources$ANSI_NOCOLOR\n"
-
- p="mkdir /work && cd /work"
- p="$p && curl -L https://github.com/tgingold/ghdl/archive/master.tar.gz | tar xz"
- p="$p && mv ghdl-master/* ./ && rm -rf ghdl-master"
-
- set +e
- docker run --name ghdl_cmp -t "$DOCKER_IMG" sh -c "$p &&./dist/linux/buildtest.sh $ENABLECOLOR -t $TASK -b $BLD -f $PKG_FILE"
- docker cp "ghdl_cmp:/work/log.log" "./log.log"
- set -e
- docker cp "ghdl_cmp:/work/$PKG_FILE" ./
- docker rm ghdl_cmp
-
-else
-
- docker run --rm -tv $(pwd):/work:Z -w="/work" "$DOCKER_IMG" sh -c "./dist/linux/buildtest.sh $ENABLECOLOR -t $TASK -b $BLD -f $PKG_FILE > log.log 2>&1"
-
-fi
diff --git a/dist/linux/docker/build-fedora26+mcode b/dist/linux/docker/build-fedora26+mcode
new file mode 100644
index 000000000..fb0aaee9d
--- /dev/null
+++ b/dist/linux/docker/build-fedora26+mcode
@@ -0,0 +1,5 @@
+# Fedora 26
+FROM fedora:26
+
+RUN dnf --nodocs -y install gcc-gnat zlib-devel make \
+ && dnf clean all
diff --git a/dist/linux/docker/build-stretch+mcode b/dist/linux/docker/build-stretch+mcode
new file mode 100644
index 000000000..2830f0769
--- /dev/null
+++ b/dist/linux/docker/build-stretch+mcode
@@ -0,0 +1,7 @@
+# Debian 9
+FROM debian:stretch-slim
+
+RUN apt-get update -qq \
+ && apt-get -y install --no-install-recommends \
+ gnat gcc make zlib1g-dev \
+ && apt-get clean
diff --git a/dist/linux/docker/build-ubuntu14+llvm-3.8 b/dist/linux/docker/build-ubuntu14+llvm-3.8
new file mode 100644
index 000000000..e90ab7bbc
--- /dev/null
+++ b/dist/linux/docker/build-ubuntu14+llvm-3.8
@@ -0,0 +1,7 @@
+# Ubuntu 14
+FROM ubuntu:trusty
+
+RUN apt-get update -qq \
+ && apt-get -y install --no-install-recommends \
+ gnat gcc make zlib1g-dev llvm-3.8-dev clang-3.8 \
+ && apt-get clean
diff --git a/dist/linux/docker/build-ubuntu14+mcode b/dist/linux/docker/build-ubuntu14+mcode
new file mode 100644
index 000000000..6756dc35f
--- /dev/null
+++ b/dist/linux/docker/build-ubuntu14+mcode
@@ -0,0 +1,7 @@
+# Ubuntu 14
+FROM ubuntu:trusty
+
+RUN apt-get update -qq \
+ && apt-get -y install --no-install-recommends \
+ gnat gcc make zlib1g-dev \
+ && apt-get clean
diff --git a/dist/linux/travis-ci.sh b/dist/linux/travis-ci.sh
index 44ca465c1..a3eaf78df 100755
--- a/dist/linux/travis-ci.sh
+++ b/dist/linux/travis-ci.sh
@@ -1,6 +1,8 @@
#! /bin/bash
# This script is executed in the travis-ci environment.
+set -e
+
. dist/ansi_color.sh
#disable_color
@@ -28,76 +30,38 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then
exit
fi
-# List of docker images
-
-images=("ghdl/ghdl-tools:ubuntu-mcode"
- "ghdl/ghdl-tools:ubuntu1404-llvm"
- "ghdl/ghdl-tools:ubuntu1204-llvm"
- "ghdl/ghdl-tools:fedora-llvm-mcode")
-
-# docker image index + identifier + compiler
-
-regular="0+ubuntu+mcode 3+fedora+llvm"
-nightly="1+ubuntu1404+llvm-3.5 2+ubuntu1204+llvm-3.8 3+fedora+mcode"
-#release=()
-
-# Selected build matrix
-thismatrix=regular
-
-#---
-
-cloned=$(pwd)
-
-#### Per build function
-
-task() {
- printf "$ANSI_YELLOW[$1| BUILD] $2 $ANSI_NOCOLOR\n"
+if [ "$DOCKER_IMAGE" = "" ]; then
+ echo "DOCKER_IMAGE not defined"
+ exit 1
+fi
- IFS='+' read -ra REFS <<< "$2"
- DBLD=${REFS[2]}
- DDIST=${REFS[1]}
- DIMG=${images[${REFS[0]}]}
- thisworkdir="../wrk-$1"
- cp -r ./ "$thisworkdir" && cd "$thisworkdir"
- ./dist/linux/docker-buildtest.sh -i "$DIMG" $ENABLECOLOR -t "$1" -b "$DBLD" -f "ghdl-$PKG_TAG-$DBLD-$DDIST.tgz"
- cd "$cloned"
-}
+IFS='+' read -ra REFS <<< "$DOCKER_IMAGE"
+DBLD=${REFS[1]}
+DDIST=${REFS[0]}
-#### Start builds
+. ./dist/linux/travis-utils.sh
-printf "$ANSI_YELLOW[TRAVIS] Running matrix $thismatrix $ANSI_NOCOLOR\n"
-eval blds='${'$thismatrix'}'
-t=0; for thisbuild in $blds; do
- task "$t" "$thisbuild" &
- t=$(($t+1));
-done
+# Execute build and test in docker container
+echo "travis_fold:start:create"
+travis_time_start
+printf "$ANSI_YELLOW[DOCKER build] Docker build $ANSI_NOCOLOR\n"
-#### Wait end of builds
+DOCKERFILE="dist/linux/docker/build-$DOCKER_IMAGE"
+DOCKERCMD="./dist/linux/buildtest.sh $ENABLECOLOR -t 0 -b $DBLD -f ghdl-${PKG_TAG}-${DBLD}-${DDIST}.tgz"
-printf "$ANSI_YELLOW[TRAVIS] Waiting... $ANSI_NOCOLOR\n"
-wait
+echo "dockerfile: $DOCKERFILE"
+echo "docker cmd: $DOCKERCMD"
+DOCKER_NAME=`echo $DOCKER_IMAGE | sed -e 's/+/-/g'`
-#### Check results, disp logs
+docker build -t $DOCKER_NAME - < $DOCKERFILE
+travis_time_finish
+echo "travis_fold:end:create"
-EXITCODE=0;
-t=0; for b in $blds; do
- workdir="../wrk-$t"
- # Display log (with travis log folding commands)
- echo "travis_fold:start:log.$t"
- printf "$ANSI_YELLOW[TRAVIS] Print BUILD $t log $ANSI_NOCOLOR\n"
- cat $workdir/log.log
- echo "travis_fold:end:log.$t"
+docker run --rm --tty --volume $(pwd):/work -w "/work" $DOCKER_NAME bash -c "$DOCKERCMD"
- # Read the last line of the log
- RESULT="$(tail -1 $workdir/log.log)"
- # If it did not end with [$t|SUCCESSFUL], break the build
- if [ "$RESULT" != "[$t|SUCCESSFUL]" ]; then
- printf "$ANSI_RED[TRAVIS] BUILD $t failed $ANSI_NOCOLOR\n"
- EXITCODE=1;
- else
- cp $workdir/ghdl-*.tgz .
- fi
- t=$(($t+1));
-done
+ls -l ghdl-*
-exit $EXITCODE
+if [ ! -f build_ok ]; then
+ printf "$ANSI_RED[TRAVIS] BUILD failed $ANSI_NOCOLOR\n"
+ exit 1
+fi
diff --git a/dist/linux/travis-utils.sh b/dist/linux/travis-utils.sh
new file mode 100644
index 000000000..3f644c930
--- /dev/null
+++ b/dist/linux/travis-utils.sh
@@ -0,0 +1,22 @@
+# This is a trimmed down copy of
+# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
+travis_time_start() {
+ travis_timer_id=$RANDOM
+ travis_start_time=$(travis_nanoseconds)
+ echo "travis_time:start:$travis_timer_id"
+}
+travis_time_finish() {
+ travis_end_time=$(travis_nanoseconds)
+ local duration=$(($travis_end_time-$travis_start_time))
+ echo "travis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration"
+}
+
+if [ "$TRAVIS_OS_NAME" = "osx" ]; then
+ travis_nanoseconds() {
+ date -u '+%s000000000'
+ }
+else
+ travis_nanoseconds() {
+ date -u '+%s%N'
+ }
+fi