From feeb46d236b532eaf6e4b4f48925467a3573a207 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Sun, 27 May 2018 06:46:52 +0200 Subject: move docker-related resources to ghdl/docker --- .travis.yml | 52 ++++--------- dist/linux/build.sh | 144 ------------------------------------ dist/linux/create.sh | 24 ------ dist/linux/deploy2dockerhub.sh | 32 -------- dist/linux/docker/build/buster | 11 --- dist/linux/docker/build/fedora26 | 12 --- dist/linux/docker/build/stretch | 11 --- dist/linux/docker/build/ubuntu14 | 16 ---- dist/linux/docker/build/ubuntu16 | 16 ---- dist/linux/docker/build/ubuntu18 | 16 ---- dist/linux/docker/run/buster | 10 --- dist/linux/docker/run/fedora26 | 12 --- dist/linux/docker/run/stretch | 10 --- dist/linux/docker/run/ubuntu14 | 16 ---- dist/linux/docker/run/ubuntu16 | 16 ---- dist/linux/docker/run/ubuntu18 | 16 ---- dist/linux/test.sh | 114 ----------------------------- dist/linux/travis-ci.sh | 132 --------------------------------- dist/linux/travis-enc-dockerhub.sh | 13 ---- dist/linux/travis-utils.sh | 23 ------ dist/travis/build.sh | 146 +++++++++++++++++++++++++++++++++++++ dist/travis/test.sh | 116 +++++++++++++++++++++++++++++ dist/travis/travis-ci.sh | 131 +++++++++++++++++++++++++++++++++ dist/travis/travis-utils.sh | 23 ++++++ 24 files changed, 429 insertions(+), 683 deletions(-) delete mode 100755 dist/linux/build.sh delete mode 100644 dist/linux/create.sh delete mode 100755 dist/linux/deploy2dockerhub.sh delete mode 100644 dist/linux/docker/build/buster delete mode 100644 dist/linux/docker/build/fedora26 delete mode 100644 dist/linux/docker/build/stretch delete mode 100644 dist/linux/docker/build/ubuntu14 delete mode 100644 dist/linux/docker/build/ubuntu16 delete mode 100644 dist/linux/docker/build/ubuntu18 delete mode 100644 dist/linux/docker/run/buster delete mode 100644 dist/linux/docker/run/fedora26 delete mode 100644 dist/linux/docker/run/stretch delete mode 100644 dist/linux/docker/run/ubuntu14 delete mode 100644 dist/linux/docker/run/ubuntu16 delete mode 100644 dist/linux/docker/run/ubuntu18 delete mode 100755 dist/linux/test.sh delete mode 100755 dist/linux/travis-ci.sh delete mode 100755 dist/linux/travis-enc-dockerhub.sh delete mode 100644 dist/linux/travis-utils.sh create mode 100755 dist/travis/build.sh create mode 100755 dist/travis/test.sh create mode 100755 dist/travis/travis-ci.sh create mode 100644 dist/travis/travis-utils.sh diff --git a/.travis.yml b/.travis.yml index 29b635973..5fa18be79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,33 +8,13 @@ sudo: required services: docker language: minimal install: skip -script: "./dist/linux/travis-ci.sh" +script: "./dist/travis/travis-ci.sh" addons: apt: packages: - docker-ce -deploy: - - &deploy-docker - provider: script - skip_cleanup: true - script: ./dist/linux/deploy2dockerhub.sh "$IMAGE" "$TRAVIS_COMMIT_MESSAGE" - on: - repo: 1138-4EB/ghdl - branch: master - - &deploy-releases - provider: releases - skip_cleanup: true - api_key: - secure: ji6LXOmD5V2N+ELHZr4oJsmxPhedk+8W6jfCqQdEbewQ42N+fKOq3lgqJni7ZdfpZaulB9OHPTApv3bwOjXjtN9rfBGmq//U9CwvzHmUeomdQv6WQOVevaWSXl3DNL9fk3yKynyFrsv4pvr45L8GIjaHLggKcYhNFPJ2rrnJlDoFT9MqQNpmP7Bg/LnwVQiv+ZDPkLlMWQzrXzLamdQILARPQka+kCdXl/sHH6OKvLgRvu9yvyXYSSfbyAHP+THISS5gDciizSBeWGlU75kgj/N+mkV+8NvtTTfEIgG8y49WJz6aBooTmRzk/jZW1dKMbDR6c5bpTmRvMZSzeSBuAR6WLhr6HevgCPi/1fX1y3pkVSrgBUF5KcxPgWCZp0I05QjaJOdvQDl1hH4TlVwpT18lM2+cWrui9fS7spnk/AuNKX882C5QWWRy28lIPasCVnwfeKX8a9KAwY9OqVOenoLC1yx7NJOGfH1bjuSYYxyR4XgLiGTHKALAuknCyD9QL0o378IwqxHMcsN0Gsd+GndMu0/b8GvSqfzDpV1XknqabQFwkZLs+Yydw0snfBUzXw9TfOk78IiPYEgXAxsQKBAkK7qvO36HIxLlSQXglXU1D4IDtQYDUel6vKll4pgu0WMxStQCbj51yDVJKvRhzwiBNC6Pwgzt2JTrpwM/T/U= - file: "ghdl-*.tgz" - file_glob: true - on: - repo: ghdl/ghdl - all_branches: true - tags: true - # For each linux build, a different job/instance (with the constraints # above) is executed in parallel in stage 'test'. env: @@ -45,32 +25,28 @@ env: # - IMAGE=buster+mcode+gpl - IMAGE=ubuntu14+mcode - IMAGE=ubuntu14+llvm-3.8 -# - IMAGE=ubuntu16+mcode -# - IMAGE=ubuntu16+llvm-3.9 # - IMAGE=ubuntu18+mcode # - IMAGE=ubuntu18+llvm-5.0 - IMAGE=fedora26+mcode -# - IMAGE=fedora26+llvm - global: - - secure: "MZHtYkWdYK+SeYzJvWD8I0tbkdHGjmWyNDn70a2RrNYFu363Zt51ZvksEtkjrS7kdje6l6VPfLjilX5UtywIM1Mg6nt/rsw4p62+bGhMyhfXiqS3eqEfH2sThjosy773X8iotm2sW0ax0oHX07ZLcuTbZ+TK2cMGarZ+LzNT8IiMaeaWu4W7aE5LRxSmVRwcACUOa3NiC7GY/qC7vU2C8QNdXSlU3fSp17K5eccrkkBuiEhRTsdr3ZIhjOjrYzqHKWC3a0uHn/fJsbepsVM6FGt+zAwo0VqdXXCE2ts8EOATvFgEaCGxUgfGd/yvNsAG7sjF3nweR9Z11dpMbBE+TjxlLCXQ31v1Oj7pH6vcgjCYV69cZiLbsDhxTJFQ08qbm3xK8dmTUXFy1scrMSd8D/Q3Uf0LjHkH5Q5dL8TOyqejs57fUTIBtBUpCTvvGOErdZQAOWJc93sC9RQB7BuCDR2yR7rPTJr4KUwspe1uScA/H9cQS2p42SeJ4+Yyjtwod3IQWjr6+/pdNPoImleOP0dXSDCXpAIsbv6TR9curS3geLJuTmu5UnLzbURDr7Whtop3lCPbiN0H9jThSuyIxWUI+6JDGDG89RXbCyZvGz97sIShYstWg0U0xLWmw9IDez2HtK5VKuTT/hE7gDicZ0erN6r1dlix3SpuCtH1MlA=" #U - - secure: "kIA09oCHzoHMK4LsfwcaVaMuoAFpd1M+M8tW3b9Rvki/hEB3y46edlb88lWVM7RgkNoCaIPwAZD7Wf3Xiq9Y7wWmqRsWQNRaorC0xke5SuyMwCSQSNo9S5jAu9SM5uxENCH9yucJl/vm2juYitJCHyYYMb4x17fy3sHKULNJ+JBqnrgOuTBYM1JOIkJVO1P5LqEXmqTtr6KgQgiTMtlvnM7hxjapgoyM3J1376f+Kfky0hUoDD7LFLXu8yQCn5Fnar8wR3czK6Qknafmckt5yWJxGOZobMDfKwOdA0fpU+XiArNQ/1NM80fGXq4YOGK5ycVQkO2ACxDqHYfQRYLlIfrUGp75BoXWwN6O1GoOrFcF7ZIoSaLoK3hZdvzRFT7dpUQFlosn00Y7VzqbosQM5QS5TBBqO+DExnkb399OpXI7o0lrlr232kjAeYqEb6N1n3M9BpiNW9Je4plJa/RDKwYsnC8Qak4G08PVTe6V711W1UtqMPd6efWFYTNvRW9tjO3v1lFGaGJ99ABP0AYLIDYWV3zfgvp0UzQOKFdWJj7dMQxdLMQ/bIETKn8P7NFjOWic4pgtp3zekZCL27blhc0fyHm62HUiVLT+VGFOI/nyclzBIZStSVuxPj2LvmAIiMnUNmWwds1ZqIZ21eiNykkn+k52ddTRHXIh2fhvWfg=" #P + - IMAGE=fedora26+llvm -stages: - - create ghdl/build and ghdl/run images - - test +deploy: + provider: releases + skip_cleanup: true + api_key: + secure: ji6LXOmD5V2N+ELHZr4oJsmxPhedk+8W6jfCqQdEbewQ42N+fKOq3lgqJni7ZdfpZaulB9OHPTApv3bwOjXjtN9rfBGmq//U9CwvzHmUeomdQv6WQOVevaWSXl3DNL9fk3yKynyFrsv4pvr45L8GIjaHLggKcYhNFPJ2rrnJlDoFT9MqQNpmP7Bg/LnwVQiv+ZDPkLlMWQzrXzLamdQILARPQka+kCdXl/sHH6OKvLgRvu9yvyXYSSfbyAHP+THISS5gDciizSBeWGlU75kgj/N+mkV+8NvtTTfEIgG8y49WJz6aBooTmRzk/jZW1dKMbDR6c5bpTmRvMZSzeSBuAR6WLhr6HevgCPi/1fX1y3pkVSrgBUF5KcxPgWCZp0I05QjaJOdvQDl1hH4TlVwpT18lM2+cWrui9fS7spnk/AuNKX882C5QWWRy28lIPasCVnwfeKX8a9KAwY9OqVOenoLC1yx7NJOGfH1bjuSYYxyR4XgLiGTHKALAuknCyD9QL0o378IwqxHMcsN0Gsd+GndMu0/b8GvSqfzDpV1XknqabQFwkZLs+Yydw0snfBUzXw9TfOk78IiPYEgXAxsQKBAkK7qvO36HIxLlSQXglXU1D4IDtQYDUel6vKll4pgu0WMxStQCbj51yDVJKvRhzwiBNC6Pwgzt2JTrpwM/T/U= + file: "ghdl-*.tgz" + file_glob: true + on: + repo: ghdl/ghdl + all_branches: true + tags: true jobs: include: - # A single job is described in its own stage, to create and push ghdl/build and ghdl/run images. - - stage: create ghdl/build and ghdl/run images - env: IMAGE="" - script: if echo "$TRAVIS_COMMIT_MESSAGE" | grep -F -q "[ci images]"; then ./dist/linux/create.sh; fi; - deploy: - - <<: *deploy-docker # Additional jobs are described in stage 'test' for the macos build. # The constraints above are used, except explicitly overriden. - &osx - stage: test os: osx language: c osx_image: xcode9.3 @@ -79,7 +55,5 @@ jobs: directories: - gnat env: IMAGE=macosx+mcode - deploy: - - <<: *deploy-releases # - <<: *osx # osx_image: xcode8.3 diff --git a/dist/linux/build.sh b/dist/linux/build.sh deleted file mode 100755 index 2f0e6c705..000000000 --- a/dist/linux/build.sh +++ /dev/null @@ -1,144 +0,0 @@ -#! /bin/bash - -. dist/linux/travis-utils.sh -. dist/ansi_color.sh -disable_color - -echo "$0" "$@" - -# 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";; - "--build"|"-build") set -- "$@" "-b";; - "--pkg"|"-pkg") set -- "$@" "-p";; - "--gpl"|"-gpl") set -- "$@" "-g";; - *) set -- "$@" "$arg" - esac -done -# Parse args -while getopts ":b:p:cg" opt; do - case $opt in - c) enable_color;; - b) BLD=$OPTARG ;; - p) PKG_NAME=$OPTARG;; - g) ISGPL=true;; - \?) printf "$ANSI_RED[GHDL - build] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 - exit 1 ;; - :) printf "$ANSI_RED[GHDL - build] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 - exit 1 ;; - esac -done - -rm -f build_ok - -#--- Env - -echo "travis_fold:start:env.docker" -printf "$ANSI_YELLOW[Info] Environment $ANSI_NOCOLOR\n" -env -echo "travis_fold:end:env.docker" - -#--- GPL: gpl-ize sources - -if [ "$ISGPL" = "true" ]; then - echo "travis_fold:start:gpl.src" - printf "$ANSI_YELLOW[Source] create GPL sources $ANSI_NOCOLOR\n" - files=`echo *` - make -f Makefile.in srcdir=. clean-pure-gpl - mkdir ${PKG_NAME} - cp -pdrl $files ${PKG_NAME} - tar -zcf "${PKG_NAME}.tar.gz" ${PKG_NAME} - PKG_NAME="${PKG_NAME}-${BLD}" - echo "travis_fold:end:gpl.src" -fi - -#--- Configure - -echo "travis_fold:start:configure" -printf "$ANSI_YELLOW[GHDL - build] Configure $ANSI_NOCOLOR\n" - -CDIR=$(pwd) -export prefix="$CDIR/install-$BLD" -mkdir "$prefix" -mkdir "build-$BLD" -cd "build-$BLD" - -case "$BLD" in - mcode) - config_opts="" - CXX="" - ;; - llvm) - CXX="clang" - config_opts="--with-llvm-config CXX=$CXX" - ;; - llvm-3.5) - CXX="clang++" - config_opts="--with-llvm-config=llvm-config-3.5 CXX=$CXX" - ;; - llvm-3.8) - CXX="clang++-3.8" - config_opts="--with-llvm-config=llvm-config-3.8 CXX=$CXX" - ;; - llvm-3.9) - CXX="clang++-3.9" - config_opts="--with-llvm-config=llvm-config-3.9 CXX=$CXX" - ;; - llvm-4.0) - CXX="clang++-4.0" - config_opts="--with-llvm-config=llvm-config-4.0 CXX=$CXX" - ;; - llvm-5.0) - CXX="clang++-5.0" - config_opts="--with-llvm-config=llvm-config-5.0 CXX=$CXX" - ;; - *) - echo "$ANSI_RED[GHDL - build] Unknown build $BLD $ANSI_NOCOLOR" - exit 1;; -esac -echo "../configure --prefix=$prefix $config_opts" -../configure "--prefix=$prefix" $config_opts -echo "travis_fold:end:configure" - -#--- make - -echo "travis_fold:start:make" -travis_time_start -printf "$ANSI_YELLOW[GHDL - build] Make $ANSI_NOCOLOR\n" -make -travis_time_finish -echo "travis_fold:end:make" - -echo "travis_fold:start:install" -printf "$ANSI_YELLOW[GHDL - build] Install $ANSI_NOCOLOR\n" -make install -cd .. -echo "travis_fold:end:install" - -#--- package - -echo "travis_fold:start:tar.bin" -printf "$ANSI_YELLOW[GHDL - build] Create package ${ANSI_DARKCYAN}${PKG_NAME}.tgz $ANSI_NOCOLOR\n" -tar -zcvf "${PKG_NAME}.tgz" -C "$prefix" . -echo "travis_fold:end:tar.bin" - -#--- build tools versions - -{ - make --version | grep 'Make' - gnatls --version | grep 'GNATLS' - gcc --version | grep 'gcc' - if [ "$CXX" != "" ]; then - $CXX --version | grep 'clang' - fi -} > BUILD_TOOLS - -#--- - -echo "[SUCCESSFUL]" -touch build_ok diff --git a/dist/linux/create.sh b/dist/linux/create.sh deleted file mode 100644 index aed834fa0..000000000 --- a/dist/linux/create.sh +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -# This script is executed in the travis-ci environment. - -set -e - -. dist/linux/travis-utils.sh -. dist/ansi_color.sh -#disable_color - -scriptdir=$(dirname $0) - -for d in build run; do - currentdir="${scriptdir}/docker/$d" - for f in `ls $currentdir`; do - for tag in `grep -oP "FROM.*AS \K.*" ${currentdir}/$f`; do - echo "travis_fold:start:${f}-$tag" - travis_time_start - printf "$ANSI_BLUE[DOCKER build] ${d} : ${f} - ${tag}$ANSI_NOCOLOR\n" - docker build -t ghdl/${d}:${f}-${tag} --target $tag - < ${currentdir}/$f - travis_time_finish - echo "travis_fold:end:${f}-$tag" - done - done -done diff --git a/dist/linux/deploy2dockerhub.sh b/dist/linux/deploy2dockerhub.sh deleted file mode 100755 index 63b9fc8d9..000000000 --- a/dist/linux/deploy2dockerhub.sh +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh - -set -e - -. dist/linux/travis-utils.sh -. dist/ansi_color.sh -#disable_color - -# Skip deploy if we are in stage 0 (i.e. IMAGE="") and there is no '[ci images]' in the commit message -if [ "$1" = "skip" ] || [ "${1}$(echo $2 | grep -o '\[ci images\]')" = "" ]; then - printf "${ANSI_GREEN}SKIP DEPLOY2DOCKERHUB$ANSI_NOCOLOR\n"; - exit 0; -fi - -case $1 in - "") FILTER="/";; - *) FILTER="/ghdl /pkg";; -esac - -docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" -for key in $FILTER; do - for tag in `echo $(docker images ghdl$key* | awk -F ' ' '{print $1 ":" $2}') | cut -d ' ' -f2-`; do - if [ "$tag" = "REPOSITORY:TAG" ]; then break; fi - echo "travis_fold:start:`echo $tag | grep -oP 'ghdl/\K.*'`" - travis_time_start - printf "$ANSI_YELLOW[DOCKER push] ${tag}$ANSI_NOCOLOR\n" - docker push $tag - travis_time_finish - echo "travis_fold:end:`echo $tag | grep -oP 'ghdl/\K.*'`" - done -done -docker logout diff --git a/dist/linux/docker/build/buster b/dist/linux/docker/build/buster deleted file mode 100644 index 776b51485..000000000 --- a/dist/linux/docker/build/buster +++ /dev/null @@ -1,11 +0,0 @@ -# [build] Debian 10 - -FROM debian:buster-slim AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - gnat gcc make zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS mcode-gpl diff --git a/dist/linux/docker/build/fedora26 b/dist/linux/docker/build/fedora26 deleted file mode 100644 index dfbf99a6c..000000000 --- a/dist/linux/docker/build/fedora26 +++ /dev/null @@ -1,12 +0,0 @@ -# [build] Fedora 26 - -FROM fedora:26 AS mcode - -RUN dnf --nodocs -y install gcc-gnat zlib-devel make \ - && dnf clean all --enablerepo=\* - - -FROM mcode AS llvm - -RUN dnf --nodocs -y install llvm-devel gcc-c++ clang \ - && dnf clean all --enablerepo=\* diff --git a/dist/linux/docker/build/stretch b/dist/linux/docker/build/stretch deleted file mode 100644 index 9803a5619..000000000 --- a/dist/linux/docker/build/stretch +++ /dev/null @@ -1,11 +0,0 @@ -# [build] Debian 9 - -FROM debian:stretch-slim AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - gnat gcc make zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS mcode-gpl diff --git a/dist/linux/docker/build/ubuntu14 b/dist/linux/docker/build/ubuntu14 deleted file mode 100644 index 924fd7297..000000000 --- a/dist/linux/docker/build/ubuntu14 +++ /dev/null @@ -1,16 +0,0 @@ -# [build] Ubuntu 14 - -FROM ubuntu:trusty AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - gnat gcc make zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-3.8 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - llvm-3.8-dev clang-3.8 \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/docker/build/ubuntu16 b/dist/linux/docker/build/ubuntu16 deleted file mode 100644 index 308377e19..000000000 --- a/dist/linux/docker/build/ubuntu16 +++ /dev/null @@ -1,16 +0,0 @@ -# [build] Ubuntu 16 - -FROM ubuntu:xenial AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - gnat gcc make zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-3.9 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - llvm-3.9-dev clang-3.9 \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/docker/build/ubuntu18 b/dist/linux/docker/build/ubuntu18 deleted file mode 100644 index ac514a554..000000000 --- a/dist/linux/docker/build/ubuntu18 +++ /dev/null @@ -1,16 +0,0 @@ -# [build] Ubuntu 18 - -FROM ubuntu:bionic AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - gnat gcc make zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-5.0 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - llvm-5.0-dev clang-5.0 \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/docker/run/buster b/dist/linux/docker/run/buster deleted file mode 100644 index ff5bbf3da..000000000 --- a/dist/linux/docker/run/buster +++ /dev/null @@ -1,10 +0,0 @@ -# [run] Debian 10 - -FROM debian:buster-slim AS mcode - -RUN apt-get update -qq \ - && apt-get -y install libgnat-7 gcc libc6-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS mcode-gpl diff --git a/dist/linux/docker/run/fedora26 b/dist/linux/docker/run/fedora26 deleted file mode 100644 index ff0e17bc2..000000000 --- a/dist/linux/docker/run/fedora26 +++ /dev/null @@ -1,12 +0,0 @@ -# [run] Fedora 26 - -FROM fedora:26 AS mcode - -RUN dnf --nodocs -y install libgnat gcc \ - && dnf clean all --enablerepo=\* - - -FROM mcode AS llvm - -RUN dnf --nodocs -y install llvm-libs zlib-devel \ - && dnf clean all --enablerepo=\* diff --git a/dist/linux/docker/run/stretch b/dist/linux/docker/run/stretch deleted file mode 100644 index 1d42722eb..000000000 --- a/dist/linux/docker/run/stretch +++ /dev/null @@ -1,10 +0,0 @@ -# [run] Debian 9 - -FROM debian:stretch-slim AS mcode - -RUN apt-get update -qq \ - && apt-get -y install libgnat-6 gcc libc6-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS mcode-gpl diff --git a/dist/linux/docker/run/ubuntu14 b/dist/linux/docker/run/ubuntu14 deleted file mode 100644 index 6c72d9c19..000000000 --- a/dist/linux/docker/run/ubuntu14 +++ /dev/null @@ -1,16 +0,0 @@ -# [run] Ubuntu 14 - -FROM ubuntu:trusty AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libgnat-4.6 gcc libc6-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-3.8 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libllvm-3.8 zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/docker/run/ubuntu16 b/dist/linux/docker/run/ubuntu16 deleted file mode 100644 index 2bccad554..000000000 --- a/dist/linux/docker/run/ubuntu16 +++ /dev/null @@ -1,16 +0,0 @@ -# [run] Ubuntu 16 - -FROM ubuntu:xenial AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libgnat-4.9 gcc libc6-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-3.9 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libllvm-3.9 zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/docker/run/ubuntu18 b/dist/linux/docker/run/ubuntu18 deleted file mode 100644 index 1b2f956ac..000000000 --- a/dist/linux/docker/run/ubuntu18 +++ /dev/null @@ -1,16 +0,0 @@ -# [run] Ubuntu 18 - -FROM ubuntu:bionic AS mcode - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libgnat-7 gcc libc6-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove - - -FROM mcode AS llvm-5.0 - -RUN apt-get update -qq \ - && apt-get -y install --no-install-recommends \ - libllvm5.0 zlib1g-dev \ - && apt-get autoclean && apt-get clean && apt-get autoremove diff --git a/dist/linux/test.sh b/dist/linux/test.sh deleted file mode 100755 index e95bccbb6..000000000 --- a/dist/linux/test.sh +++ /dev/null @@ -1,114 +0,0 @@ -#! /bin/bash - -. dist/linux/travis-utils.sh -. dist/ansi_color.sh -disable_color - -echo "$0" "$@" - -# 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";; - "--gpl"|"-gpl") set -- "$@" "-g";; - *) set -- "$@" "$arg" - esac -done -# Parse args -while getopts ":b:p:cg" opt; do - case $opt in - c) enable_color;; - g) ISGPL=true;; - \?) printf "$ANSI_RED[GHDL - test] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 - exit 1 ;; - :) printf "$ANSI_RED[GHDL - test] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 - exit 1 ;; - esac -done - -rm -f test_ok - -export ENABLECOLOR -if [ "$GHDL" = "" ]; then - export GHDL="$prefix/bin/ghdl" -fi -cd testsuite -failures="" - -echo "travis_fold:start:tests.sanity" -travis_time_start -printf "$ANSI_YELLOW[GHDL - test] sanity $ANSI_NOCOLOR\n" -cd sanity -for d in [0-9]*; do - cd $d - if ./testsuite.sh > test.log 2>&1 ; then - echo "sanity $d: ok" - # Don't disp log - else - echo "${ANSI_RED}sanity $d: failed${ANSI_NOCOLOR}" - cat test.log - failures="$failures $d" - fi - cd .. - # Stop at the first failure - [ "$failures" = "" ] || break -done -cd .. -travis_time_finish -echo "travis_fold:end:tests.sanity" -[ "$failures" = "" ] || exit 1 - -if [ "$ISGPL" != "true" ]; then - echo "travis_fold:start:tests.gna" - travis_time_start - printf "$ANSI_YELLOW[GHDL - test] gna $ANSI_NOCOLOR\n" - cd gna - dirs=`./testsuite.sh --list-tests` - for d in $dirs; do - cd $d - if ./testsuite.sh > test.log 2>&1 ; then - echo "gna $d: ok" - # Don't disp log - else - echo "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}" - cat test.log - failures="$failures $d" - fi - cd .. - # Stop at the first failure - [ "$failures" = "" ] || break - done - cd .. - travis_time_finish - echo "travis_fold:end:tests.gna" - [ "$failures" = "" ] || exit 1 -fi - -echo "travis_fold:start:tests.vests" -travis_time_start -printf "$ANSI_YELLOW[GHDL - test] vests $ANSI_NOCOLOR\n" -cd vests -if ./testsuite.sh > vests.log 2>&1 ; then - echo "${ANSI_GREEN}Vests is OK$ANSI_NOCOLOR" - wc -l vests.log -else - cat vests.log - echo "${ANSI_RED}Vests failure$ANSI_NOCOLOR" - failures=vests -fi -cd .. -travis_time_finish -echo "travis_fold:end:tests.vests" -[ "$failures" = "" ] || exit 1 - -$GHDL --version -cd .. - -#--- - -echo "[SUCCESSFUL]" -touch test_ok diff --git a/dist/linux/travis-ci.sh b/dist/linux/travis-ci.sh deleted file mode 100755 index 2585685c8..000000000 --- a/dist/linux/travis-ci.sh +++ /dev/null @@ -1,132 +0,0 @@ -#! /bin/bash -# This script is executed in the travis-ci environment. - -build_img_ghdl() { - # Build ghdl/ghdl from ghdl/run - echo "travis_fold:start:build_run" - travis_time_start - printf "$ANSI_BLUE[DOCKER build] ghdl : ${IMAGE_TAG}$ANSI_NOCOLOR\n" - - PKG=`ls | grep -oP 'ghdl-.*tgz'` - mkdir tmp-img && cd tmp-img - cp ../$PKG ./ - cp ../BUILD_TOOLS ./ - echo "FROM ghdl/run:$IMAGE_TAG" > Dockerfile - echo "ADD $PKG /usr/local" >> Dockerfile - docker build -t ghdl/ghdl:$IMAGE_TAG . - cd .. - travis_time_finish - echo "travis_fold:end:build_run" -} - -#--- - -set -e - -. dist/linux/travis-utils.sh -. dist/ansi_color.sh -#disable_color - -scriptdir=$(dirname $0) - - -# Display env (to debug) - -echo -en "travis_fold:start:travis_env\r" -printf "$ANSI_YELLOW[TRAVIS] Travis environment $ANSI_NOCOLOR\n" -env | grep TRAVIS -echo -en "travis_fold:end:travis_env\r" - - -if [ "$IMAGE" = "" ]; then - echo "IMAGE not defined" - exit 1 -fi - - -echo "travis_fold:start:fetch" -# The command 'git describe' (used for version) needs the history. Get it. -# But the following command fails if the repository is complete. -git fetch --unshallow || true - -echo "travis_fold:end:fetch" - - -# Compute package name - -PKG_SHORTCOMMIT="$(printf $TRAVIS_COMMIT | cut -c1-10)" -PKG_VER=`grep "ghdl_version=" configure | sed -e 's/.*"\(.*\)";/\1/'` -if [ -z "$TRAVIS_TAG" ]; then - # No tag: use date + commit id - PKG_TAG="$(date -u +%Y%m%d)-$PKG_SHORTCOMMIT"; -elif expr "$TRAVIS_TAG" : 'v[0-9].*' > /dev/null; then - # Remove leading 'v' in tags in the filenames. - PKG_TAG="$(echo $TRAVIS_TAG | cut -c2-)" -else - # Regular tag (like snapshots), nothing to change. - PKG_TAG="$TRAVIS_TAG" -fi - -# Extract from IMAGE (defined in .travis.yml) -IFS='+' read -ra REFS <<< "$IMAGE" -DDIST=${REFS[0]} # Linux distro (eg: ubuntuXX, fedoraXX) -DBLD=${REFS[1]} # Build/backend (eg: mcode, llvm) -DGPL=${REFS[2]} # GPL or not - -PKG_NAME="ghdl-${PKG_TAG}-${DDIST}-${DBLD}" -BUILD_CMD_OPTS="$ENABLECOLOR -b $DBLD" -if [ "$DGPL" = "gpl" ]; then - BUILD_CMD_OPTS="$BUILD_CMD_OPTS --gpl" - PKG_NAME="ghdl-gpl-${PKG_TAG}" -fi -BUILD_CMD_OPTS="${BUILD_CMD_OPTS} -p $PKG_NAME" - -echo "build cmd: $BUILD_CMD_OPTS" - - -# Build - -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - # Install gnat compiler (use cache) - ./dist/macosx/install-ada.sh || exit 1 - PATH=$PWD/gnat/bin:$PATH - - bash -c "${scriptdir}/build.sh $BUILD_CMD_OPTS" -else - # Assume linux - - # Build version.tmp and replace version.in with it (so that the version is - # correctly set). - # This is a little bit hack-ish, as it assumes that 'git' is not - # available in docker (otherwise it will describe as -dirty - # because this modifies the source file version.in). - ghdl_version_line=`grep -e '^ghdl_version' configure` - make -f Makefile.in srcdir=. $ghdl_version_line version.tmp - cp version.tmp src/version.in - - # Run build in docker - IMAGE_TAG=`echo $IMAGE | sed -e 's/+/-/g'` - docker run --rm -t -v $(pwd):/work -w "/work" ghdl/build:$IMAGE_TAG bash -c "${scriptdir}/build.sh $BUILD_CMD_OPTS" -fi - -if [ ! -f build_ok ]; then - printf "$ANSI_RED[TRAVIS] BUILD failed $ANSI_NOCOLOR\n" - exit 1 -fi - - -# Test - -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - bash -c "prefix=$(realpath ./install-mcode) ${scriptdir}/test.sh $BUILD_CMD_OPTS" -else - # Build ghdl/ghdl:$IMAGE_TAG image - build_img_ghdl - # Run test in docker container - docker run --rm -t -v $(pwd):/work -w "/work" ghdl/ghdl:$IMAGE_TAG bash -c "GHDL=ghdl ${scriptdir}/test.sh $BUILD_CMD_OPTS" -fi - -if [ ! -f test_ok ]; then - printf "$ANSI_RED[TRAVIS] TEST failed $ANSI_NOCOLOR\n" - exit 1 -fi diff --git a/dist/linux/travis-enc-dockerhub.sh b/dist/linux/travis-enc-dockerhub.sh deleted file mode 100755 index a677f8039..000000000 --- a/dist/linux/travis-enc-dockerhub.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# - Run `$(command -v winpty) docker run --rm -it alpine sh -c "REPO='https://github.com//'; USERNAME=; PASSWORD=; $(cat travis-enc.sh)"` -# - Check the log and copy the secure key to `.travis.yml`: https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml - -apk add -U --no-cache git openssh ruby ruby-dev libffi-dev build-base ruby-dev libc-dev libffi-dev linux-headers -gem install travis --no-rdoc --no-ri - -git clone $REPO ./tmp-repo && cd tmp-repo - -travis login --org --auto -travis encrypt DOCKER_USER=$USERNAME -travis encrypt DOCKER_PASS=$PASSWORD diff --git a/dist/linux/travis-utils.sh b/dist/linux/travis-utils.sh deleted file mode 100644 index 8db013f7b..000000000 --- a/dist/linux/travis-utils.sh +++ /dev/null @@ -1,23 +0,0 @@ -# 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() { - # `date +%N` returns the date in nanoseconds. It is used as a replacement for $RANDOM, which is only available in bash. - travis_timer_id=`date +%N` - 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 diff --git a/dist/travis/build.sh b/dist/travis/build.sh new file mode 100755 index 000000000..297a8561b --- /dev/null +++ b/dist/travis/build.sh @@ -0,0 +1,146 @@ +#! /bin/bash + +scriptdir=$(dirname $0) + +. "$scriptdir/travis-utils.sh" +. "$scriptdir/../ansi_color.sh" +disable_color + +echo "$0" "$@" + +# 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";; + "--build"|"-build") set -- "$@" "-b";; + "--pkg"|"-pkg") set -- "$@" "-p";; + "--gpl"|"-gpl") set -- "$@" "-g";; + *) set -- "$@" "$arg" + esac +done +# Parse args +while getopts ":b:p:cg" opt; do + case $opt in + c) enable_color;; + b) BLD=$OPTARG ;; + p) PKG_NAME=$OPTARG;; + g) ISGPL=true;; + \?) printf "$ANSI_RED[GHDL - build] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 + exit 1 ;; + :) printf "$ANSI_RED[GHDL - build] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 + exit 1 ;; + esac +done + +rm -f build_ok + +#--- Env + +echo "travis_fold:start:env.docker" +printf "$ANSI_YELLOW[Info] Environment $ANSI_NOCOLOR\n" +env +echo "travis_fold:end:env.docker" + +#--- GPL: gpl-ize sources + +if [ "$ISGPL" = "true" ]; then + echo "travis_fold:start:gpl.src" + printf "$ANSI_YELLOW[Source] create GPL sources $ANSI_NOCOLOR\n" + files=`echo *` + make -f Makefile.in srcdir=. clean-pure-gpl + mkdir ${PKG_NAME} + cp -pdrl $files ${PKG_NAME} + tar -zcf "${PKG_NAME}.tar.gz" ${PKG_NAME} + PKG_NAME="${PKG_NAME}-${BLD}" + echo "travis_fold:end:gpl.src" +fi + +#--- Configure + +echo "travis_fold:start:configure" +printf "$ANSI_YELLOW[GHDL - build] Configure $ANSI_NOCOLOR\n" + +CDIR=$(pwd) +export prefix="$CDIR/install-$BLD" +mkdir "$prefix" +mkdir "build-$BLD" +cd "build-$BLD" + +case "$BLD" in + mcode) + config_opts="" + CXX="" + ;; + llvm) + CXX="clang" + config_opts="--with-llvm-config CXX=$CXX" + ;; + llvm-3.5) + CXX="clang++" + config_opts="--with-llvm-config=llvm-config-3.5 CXX=$CXX" + ;; + llvm-3.8) + CXX="clang++-3.8" + config_opts="--with-llvm-config=llvm-config-3.8 CXX=$CXX" + ;; + llvm-3.9) + CXX="clang++-3.9" + config_opts="--with-llvm-config=llvm-config-3.9 CXX=$CXX" + ;; + llvm-4.0) + CXX="clang++-4.0" + config_opts="--with-llvm-config=llvm-config-4.0 CXX=$CXX" + ;; + llvm-5.0) + CXX="clang++-5.0" + config_opts="--with-llvm-config=llvm-config-5.0 CXX=$CXX" + ;; + *) + echo "$ANSI_RED[GHDL - build] Unknown build $BLD $ANSI_NOCOLOR" + exit 1;; +esac +echo "../configure --prefix=$prefix $config_opts" +../configure "--prefix=$prefix" $config_opts +echo "travis_fold:end:configure" + +#--- make + +echo "travis_fold:start:make" +travis_time_start +printf "$ANSI_YELLOW[GHDL - build] Make $ANSI_NOCOLOR\n" +make +travis_time_finish +echo "travis_fold:end:make" + +echo "travis_fold:start:install" +printf "$ANSI_YELLOW[GHDL - build] Install $ANSI_NOCOLOR\n" +make install +cd .. +echo "travis_fold:end:install" + +#--- package + +echo "travis_fold:start:tar.bin" +printf "$ANSI_YELLOW[GHDL - build] Create package ${ANSI_DARKCYAN}${PKG_NAME}.tgz $ANSI_NOCOLOR\n" +tar -zcvf "${PKG_NAME}.tgz" -C "$prefix" . +echo "travis_fold:end:tar.bin" + +#--- build tools versions + +{ + make --version | grep 'Make' + gnatls --version | grep 'GNATLS' + gcc --version | grep 'gcc' + if [ "$CXX" != "" ]; then + $CXX --version | grep 'clang' + fi +} > BUILD_TOOLS + +#--- + +echo "[SUCCESSFUL]" +touch build_ok diff --git a/dist/travis/test.sh b/dist/travis/test.sh new file mode 100755 index 000000000..c588f01dc --- /dev/null +++ b/dist/travis/test.sh @@ -0,0 +1,116 @@ +#! /bin/bash + +scriptdir=$(dirname $0) + +. "$scriptdir/travis-utils.sh" +. "$scriptdir/../ansi_color.sh" +disable_color + +echo "$0" "$@" + +# 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";; + "--gpl"|"-gpl") set -- "$@" "-g";; + *) set -- "$@" "$arg" + esac +done +# Parse args +while getopts ":b:p:cg" opt; do + case $opt in + c) enable_color;; + g) ISGPL=true;; + \?) printf "$ANSI_RED[GHDL - test] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 + exit 1 ;; + :) printf "$ANSI_RED[GHDL - test] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 + exit 1 ;; + esac +done + +rm -f test_ok + +export ENABLECOLOR +if [ "$GHDL" = "" ]; then + export GHDL="$prefix/bin/ghdl" +fi +cd testsuite +failures="" + +echo "travis_fold:start:tests.sanity" +travis_time_start +printf "$ANSI_YELLOW[GHDL - test] sanity $ANSI_NOCOLOR\n" +cd sanity +for d in [0-9]*; do + cd $d + if ./testsuite.sh > test.log 2>&1 ; then + echo "sanity $d: ok" + # Don't disp log + else + echo "${ANSI_RED}sanity $d: failed${ANSI_NOCOLOR}" + cat test.log + failures="$failures $d" + fi + cd .. + # Stop at the first failure + [ "$failures" = "" ] || break +done +cd .. +travis_time_finish +echo "travis_fold:end:tests.sanity" +[ "$failures" = "" ] || exit 1 + +if [ "$ISGPL" != "true" ]; then + echo "travis_fold:start:tests.gna" + travis_time_start + printf "$ANSI_YELLOW[GHDL - test] gna $ANSI_NOCOLOR\n" + cd gna + dirs=`./testsuite.sh --list-tests` + for d in $dirs; do + cd $d + if ./testsuite.sh > test.log 2>&1 ; then + echo "gna $d: ok" + # Don't disp log + else + echo "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}" + cat test.log + failures="$failures $d" + fi + cd .. + # Stop at the first failure + [ "$failures" = "" ] || break + done + cd .. + travis_time_finish + echo "travis_fold:end:tests.gna" + [ "$failures" = "" ] || exit 1 +fi + +echo "travis_fold:start:tests.vests" +travis_time_start +printf "$ANSI_YELLOW[GHDL - test] vests $ANSI_NOCOLOR\n" +cd vests +if ./testsuite.sh > vests.log 2>&1 ; then + echo "${ANSI_GREEN}Vests is OK$ANSI_NOCOLOR" + wc -l vests.log +else + cat vests.log + echo "${ANSI_RED}Vests failure$ANSI_NOCOLOR" + failures=vests +fi +cd .. +travis_time_finish +echo "travis_fold:end:tests.vests" +[ "$failures" = "" ] || exit 1 + +$GHDL --version +cd .. + +#--- + +echo "[SUCCESSFUL]" +touch test_ok diff --git a/dist/travis/travis-ci.sh b/dist/travis/travis-ci.sh new file mode 100755 index 000000000..628acceaf --- /dev/null +++ b/dist/travis/travis-ci.sh @@ -0,0 +1,131 @@ +#! /bin/bash +# This script is executed in the travis-ci environment. + +build_img_ghdl() { + # Build ghdl/ghdl from ghdl/run + echo "travis_fold:start:build_run" + travis_time_start + printf "$ANSI_BLUE[DOCKER build] ghdl : ${IMAGE_TAG}$ANSI_NOCOLOR\n" + + PKG=`ls | grep -oP 'ghdl-.*tgz'` + mkdir tmp-img && cd tmp-img + cp ../$PKG ./ + cp ../BUILD_TOOLS ./ + echo "FROM ghdl/run:$IMAGE_TAG" > Dockerfile + echo "ADD $PKG /usr/local" >> Dockerfile + docker build -t ghdl/ghdl:$IMAGE_TAG . + cd .. + travis_time_finish + echo "travis_fold:end:build_run" +} + +#--- + +set -e + +scriptdir=$(dirname $0) + +. "$scriptdir/travis-utils.sh" +. "$scriptdir/../ansi_color.sh" +#disable_color + +# Display env (to debug) + +echo -en "travis_fold:start:travis_env\r" +printf "$ANSI_YELLOW[TRAVIS] Travis environment $ANSI_NOCOLOR\n" +env | grep TRAVIS +echo -en "travis_fold:end:travis_env\r" + + +if [ "$IMAGE" = "" ]; then + echo "IMAGE not defined" + exit 1 +fi + + +echo "travis_fold:start:fetch" +# The command 'git describe' (used for version) needs the history. Get it. +# But the following command fails if the repository is complete. +git fetch --unshallow || true + +echo "travis_fold:end:fetch" + + +# Compute package name + +PKG_SHORTCOMMIT="$(printf $TRAVIS_COMMIT | cut -c1-10)" +PKG_VER=`grep "ghdl_version=" configure | sed -e 's/.*"\(.*\)";/\1/'` +if [ -z "$TRAVIS_TAG" ]; then + # No tag: use date + commit id + PKG_TAG="$(date -u +%Y%m%d)-$PKG_SHORTCOMMIT"; +elif expr "$TRAVIS_TAG" : 'v[0-9].*' > /dev/null; then + # Remove leading 'v' in tags in the filenames. + PKG_TAG="$(echo $TRAVIS_TAG | cut -c2-)" +else + # Regular tag (like snapshots), nothing to change. + PKG_TAG="$TRAVIS_TAG" +fi + +# Extract from IMAGE (defined in .travis.yml) +IFS='+' read -ra REFS <<< "$IMAGE" +DDIST=${REFS[0]} # Linux distro (eg: ubuntuXX, fedoraXX) +DBLD=${REFS[1]} # Build/backend (eg: mcode, llvm) +DGPL=${REFS[2]} # GPL or not + +PKG_NAME="ghdl-${PKG_TAG}-${DDIST}-${DBLD}" +BUILD_CMD_OPTS="$ENABLECOLOR -b $DBLD" +if [ "$DGPL" = "gpl" ]; then + BUILD_CMD_OPTS="$BUILD_CMD_OPTS --gpl" + PKG_NAME="ghdl-gpl-${PKG_TAG}" +fi +BUILD_CMD_OPTS="${BUILD_CMD_OPTS} -p $PKG_NAME" + +echo "build cmd: $BUILD_CMD_OPTS" + + +# Build + +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + # Install gnat compiler (use cache) + ./dist/macosx/install-ada.sh || exit 1 + PATH=$PWD/gnat/bin:$PATH + + bash -c "${scriptdir}/build.sh $BUILD_CMD_OPTS" +else + # Assume linux + + # Build version.tmp and replace version.in with it (so that the version is + # correctly set). + # This is a little bit hack-ish, as it assumes that 'git' is not + # available in docker (otherwise it will describe as -dirty + # because this modifies the source file version.in). + ghdl_version_line=`grep -e '^ghdl_version' configure` + make -f Makefile.in srcdir=. $ghdl_version_line version.tmp + cp version.tmp src/version.in + + # Run build in docker + IMAGE_TAG=`echo $IMAGE | sed -e 's/+/-/g'` + docker run --rm -t -v $(pwd):/work -w "/work" ghdl/build:$IMAGE_TAG bash -c "${scriptdir}/build.sh $BUILD_CMD_OPTS" +fi + +if [ ! -f build_ok ]; then + printf "$ANSI_RED[TRAVIS] BUILD failed $ANSI_NOCOLOR\n" + exit 1 +fi + + +# Test + +if [ "$TRAVIS_OS_NAME" = "osx" ]; then + bash -c "prefix=$(realpath ./install-mcode) ${scriptdir}/test.sh $BUILD_CMD_OPTS" +else + # Build ghdl/ghdl:$IMAGE_TAG image + build_img_ghdl + # Run test in docker container + docker run --rm -t -v $(pwd):/work -w "/work" ghdl/ghdl:$IMAGE_TAG bash -c "GHDL=ghdl ${scriptdir}/test.sh $BUILD_CMD_OPTS" +fi + +if [ ! -f test_ok ]; then + printf "$ANSI_RED[TRAVIS] TEST failed $ANSI_NOCOLOR\n" + exit 1 +fi diff --git a/dist/travis/travis-utils.sh b/dist/travis/travis-utils.sh new file mode 100644 index 000000000..8db013f7b --- /dev/null +++ b/dist/travis/travis-utils.sh @@ -0,0 +1,23 @@ +# 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() { + # `date +%N` returns the date in nanoseconds. It is used as a replacement for $RANDOM, which is only available in bash. + travis_timer_id=`date +%N` + 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 -- cgit v1.2.3