diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..096547f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: c +cache: ccache +branches: + except: + - travis + +matrix: + include: + - os: linux + dist: trusty + services: docker + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull vathpela/shim-travis-rawhide:v1 ; fi + +before_script: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM vathpela/shim-travis-rawhide:v1 > Dockerfile ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit . ; fi + +script: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run --volume $HOME/.ccache:/root/.ccache withgit /bin/sh -c "cd /root && git pull && git reset origin/master --hard && ./travis-build.sh --branch $TRAVIS_BRANCH --repo \"$TRAVIS_REPO_SLUG\" --remote \"$TRAVIS_PULL_REQUEST_SLUG\" --pr-sha \"$TRAVIS_PULL_REQUEST_SHA\"" ; fi + - ccache -s diff --git a/travis-build.sh b/travis-build.sh new file mode 100755 index 0000000..f885a9a --- /dev/null +++ b/travis-build.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# travis-build.sh +# Copyright (C) 2018 Peter Jones +# +# Distributed under terms of the GPLv3 license. +# +# + +set -euv + +usage() { + echo usage: $1 --branch '' --repo '' --remote '' --pr-sha '' + exit $2 +} + +declare origin_branch="" +declare origin_repo="" +declare remote_repo="" +declare pr_sha="" + +let n=0 || : + +if [[ $# -le 1 ]] ; then + usage $0 1 +fi + +while [[ $# > 0 ]] ; do + case " $1 " in + " --help "|" -h "|" -? ") + usage $0 0 + ;; + " --branch ") + origin_branch="$2" + shift + ;; + " --repo ") + origin_repo="$2" + shift + ;; + " --remote ") + remote_repo="$2" + shift + ;; + " --pr-sha ") + commit_id="$2" + shift + ;; + *) + usage $0 1 + ;; + esac + shift +done + +if [[ -n "${remote_repo}" ]] ; then + git remote add remote https://github.com/${remote_repo} + git fetch remote + git checkout -f ${commit_id} +fi +make EFIDIR=test ENABLE_SHIM_CERT=1 ENABLE_HTTBOOT=1 ARCH=x86_64 clean all