Add some configs for CI using github+travis+docker

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-03-14 18:10:48 -04:00
parent 8721bbe6fb
commit 06ddb2e8f5
2 changed files with 84 additions and 0 deletions

23
.travis.yml Normal file
View File

@ -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

61
travis-build.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
#
# travis-build.sh
# Copyright (C) 2018 Peter Jones <pjones@redhat.com>
#
# Distributed under terms of the GPLv3 license.
#
#
set -euv
usage() {
echo usage: $1 --branch '<origin_branch>' --repo '<origin_repo>' --remote '<remote_repo>' --pr-sha '<commit_id>'
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