aboutsummaryrefslogtreecommitdiffstats
path: root/travis.sh
diff options
context:
space:
mode:
author1138-4EB <1138-4EB@users.noreply.github.com>2019-08-16 22:07:46 +0200
committertgingold <tgingold@users.noreply.github.com>2019-08-16 22:07:46 +0200
commitd359d6deb55e5c51707c86263b090fabbc5c41b2 (patch)
treee916cb1f11ec2687bfedbd6ad02f08c3a5b068db /travis.sh
parentc924837dd7f9164aabb37983fb036ee34a9f1e40 (diff)
downloadghdl-yosys-plugin-d359d6deb55e5c51707c86263b090fabbc5c41b2.tar.gz
ghdl-yosys-plugin-d359d6deb55e5c51707c86263b090fabbc5c41b2.tar.bz2
ghdl-yosys-plugin-d359d6deb55e5c51707c86263b090fabbc5c41b2.zip
Run testsuite in Travis CI with docker images (#31)
* makefile: use '--build' shortcut to build ghdl.so * move: rename subdir 'ghdl' to 'src' * travis: add travis config file, build script and utils script * testsuite: do not call ghdl explicitly * readme: update
Diffstat (limited to 'travis.sh')
-rwxr-xr-xtravis.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/travis.sh b/travis.sh
new file mode 100755
index 0000000..086f497
--- /dev/null
+++ b/travis.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname $0)"
+. ./utils.sh
+
+prefix='//opt/ghdl'
+
+#--
+travis_start "ghdl" "[Build] ghdl/synth:latest" "$ANSI_MAGENTA"
+
+case "$TRAVIS_COMMIT_MESSAGE" in
+ "*[stable]*")
+ echo "IS_STABLE"
+ GHDL_URL="https://github.com/ghdl/ghdl/archive/9d61a62f96dc4897dadbf88f5f4ee199d20e0f8f.tar.gz"
+ ;;
+ *)
+ echo "IS_MASTER"
+ GHDL_URL="https://codeload.github.com/ghdl/ghdl/tar.gz/master"
+ ;;
+esac
+echo "GHDL_URL: $GHDL_URL"
+
+docker build -t ghdl/synth:latest - <<-EOF
+FROM ghdl/build:buster-mcode AS build
+
+RUN apt-get update -qq \
+ && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
+ ca-certificates \
+ curl \
+ && apt-get autoclean && apt-get clean && apt-get -y autoremove \
+ && update-ca-certificates \
+ && rm -rf /var/lib/apt/lists
+
+RUN mkdir -p ghdl && cd ghdl \
+ && curl -fsSL "$GHDL_URL" | tar xzf - --strip-components=1 \
+ && ./configure --prefix="$prefix" --enable-libghdl --enable-synth \
+ && make all \
+ && make install
+
+FROM ghdl/run:buster-mcode
+COPY --from=build $prefix $prefix
+ENV PATH $prefix/bin:\$PATH
+EOF
+
+travis_finish "ghdl"
+#--
+travis_start "ghdlsynth" "[Build] ghdl/synth:beta" "$ANSI_MAGENTA"
+
+docker build -t ghdl/synth:beta . -f- <<-EOF
+FROM ghdl/synth:yosys-gnat AS build
+COPY --from=ghdl/synth:latest $prefix $prefix
+COPY . /ghdlsynth
+
+RUN cd /ghdlsynth \
+ && export PATH=\$PATH:$prefix/bin \
+ && make \
+ && cp ghdl.so $prefix/lib/ghdl_yosys.so
+
+FROM ghdl/synth:yosys-gnat
+COPY --from=build $prefix $prefix
+ENV PATH $prefix/bin:\$PATH
+RUN yosys-config --exec mkdir -p --datdir/plugins \
+ && yosys-config --exec ln -s $prefix/lib/ghdl_yosys.so --datdir/plugins/ghdl.so
+EOF
+
+travis_finish "ghdlsynth"
+#---
+travis_start "testsuite" "[Test] testsuite" "$ANSI_MAGENTA"
+
+docker run --rm -t -e TRAVIS=$TRAVIS -v /$(pwd)://src -w //src -e YOSYS='yosys -m ghdl' ghdl/synth:beta bash -c "$(cat <<EOF
+./testsuite/testsuite.sh
+EOF
+)"
+
+travis_finish "testsuite"