summaryrefslogtreecommitdiff
path: root/.travis
diff options
context:
space:
mode:
Diffstat (limited to '.travis')
-rwxr-xr-x.travis/build-and-test.sh49
-rw-r--r--.travis/common.sh15
-rwxr-xr-x.travis/deploy-after-success.sh6
-rwxr-xr-x.travis/setup.sh97
4 files changed, 167 insertions, 0 deletions
diff --git a/.travis/build-and-test.sh b/.travis/build-and-test.sh
new file mode 100755
index 00000000..096dde64
--- /dev/null
+++ b/.travis/build-and-test.sh
@@ -0,0 +1,49 @@
+#! /bin/bash
+
+set -e
+
+source .travis/common.sh
+
+##########################################################################
+
+echo
+echo 'Configuring...' && echo -en 'travis_fold:start:script.configure\\r'
+echo
+
+if [ "$CONFIG" = "gcc" ]; then
+ echo "Configuring for gcc."
+ make config-gcc
+elif [ "$CONFIG" = "clang" ]; then
+ echo "Configuring for clang."
+ make config-clang
+fi
+
+echo
+echo -en 'travis_fold:end:script.configure\\r'
+echo
+
+##########################################################################
+
+echo
+echo 'Building...' && echo -en 'travis_fold:start:script.build\\r'
+echo
+
+make
+
+echo
+echo -en 'travis_fold:end:script.build\\r'
+echo
+
+##########################################################################
+
+echo
+echo 'Testing...' && echo -en 'travis_fold:start:script.test\\r'
+echo
+
+make test
+
+echo
+echo -en 'travis_fold:end:script.test\\r'
+echo
+
+##########################################################################
diff --git a/.travis/common.sh b/.travis/common.sh
new file mode 100644
index 00000000..8eecc4c0
--- /dev/null
+++ b/.travis/common.sh
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+# Setup the CC / CXX from the matrix config
+eval "${MATRIX_EVAL}"
+
+# Look for location binaries first
+export PATH="$HOME/.local-bin/bin:$PATH"
+
+# OS X specific common setup
+if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ export PATH="/usr/local/opt/ccache/libexec:$PATH"
+fi
+
+# Parallel builds!
+MAKEFLAGS="-j 2"
diff --git a/.travis/deploy-after-success.sh b/.travis/deploy-after-success.sh
new file mode 100755
index 00000000..d64e9524
--- /dev/null
+++ b/.travis/deploy-after-success.sh
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+set -x
+set -e
+
+# FIXME: Upload the build results somewhere...
diff --git a/.travis/setup.sh b/.travis/setup.sh
new file mode 100755
index 00000000..06851578
--- /dev/null
+++ b/.travis/setup.sh
@@ -0,0 +1,97 @@
+#! /bin/bash
+
+set -e
+
+source .travis/common.sh
+
+##########################################################################
+
+# Fixing Travis's git clone
+echo
+echo 'Fixing git setup...' && echo -en 'travis_fold:start:before_install.git\\r'
+echo
+git fetch --unshallow && git fetch --tags
+
+# For pull requests, we get more info about the git source.
+if [ z"$TRAVIS_PULL_REQUEST_SLUG" != z ]; then
+ echo "- Fetching from pull request source"
+ git remote add source https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git
+ git fetch source && git fetch --tags
+
+ echo "- Fetching the actual pull request"
+ git fetch origin pull/$TRAVIS_PULL_REQUEST/head:pull-$TRAVIS_PULL_REQUEST-head
+ git fetch origin pull/$TRAVIS_PULL_REQUEST/merge:pull-$TRAVIS_PULL_REQUEST-merge
+
+ git log -n 5 --graph pull-$TRAVIS_PULL_REQUEST-merge
+fi
+
+# For building branches we need to fix the "detached head" state.
+if [ z"$TRAVIS_BRANCH" != z ]; then
+ TRAVIS_COMMIT_ACTUAL=$(git log --pretty=format:'%H' -n 1)
+ echo "- Fixing detached head (current $TRAVIS_COMMIT_ACTUAL -> $TRAVIS_COMMIT)"
+ git remote -v
+ git branch -v
+ if [ x"$(git show-ref -s HEAD)" = x"$TRAVIS_COMMIT" ]; then
+ echo "Checked out at $TRAVIS_COMMIT"
+ else
+ if [ z"$TRAVIS_PULL_REQUEST_SLUG" != z ]; then
+ git fetch source $TRAVIS_COMMIT || echo "Unable to fetch $TRAVIS_COMMIT from source"
+ fi
+ git fetch origin $TRAVIS_COMMIT || echo "Unable to fetch $TRAVIS_COMMIT from origin"
+ fi
+ git branch -D $TRAVIS_BRANCH || true
+ git checkout $TRAVIS_COMMIT -b $TRAVIS_BRANCH
+ git branch -v
+fi
+
+# Output status information.
+git status
+git describe --tags
+git log -n 5 --graph
+echo
+echo -en 'travis_fold:end:before_install.git\\r'
+echo
+
+##########################################################################
+
+# Mac OS X specific setup.
+if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ (
+ echo
+ echo 'Setting up brew...' && echo -en 'travis_fold:start:before_install.brew\\r'
+ echo
+ brew update
+ brew tap Homebrew/bundle
+ brew bundle
+ brew install ccache
+ brew install gcc@7
+ echo
+ echo -en 'travis_fold:end:before_install.brew\\r'
+ echo
+ )
+fi
+
+##########################################################################
+
+# Install iverilog
+(
+ if [ ! -e ~/.local-bin/bin/iverilog ]; then
+ echo
+ echo 'Building iverilog...' && echo -en 'travis_fold:start:before_install.iverilog\\r'
+ echo
+ mkdir -p ~/.local-src
+ mkdir -p ~/.local-bin
+ cd ~/.local-src
+ git clone git://github.com/steveicarus/iverilog.git
+ cd iverilog
+ autoconf
+ ./configure --prefix=$HOME/.local-bin
+ make
+ make install
+ echo
+ echo -en 'travis_fold:end:before_install.iverilog\\r'
+ echo
+ fi
+)
+
+##########################################################################