Merge pull request #5459 from medyagh/parallel_travis

Run travis tests in parallel VMs
pull/5466/head
Medya Ghazizadeh 2019-09-25 13:22:59 -07:00 committed by GitHub
commit 115fc4fd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 43 deletions

View File

@ -1 +1,7 @@
comment: false
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
branches: null # branch names that can post comment

View File

@ -1,21 +1,37 @@
language: go
os: linux
language: go
go:
- 1.12.9
env:
- GOPROXY=https://proxy.golang.org
global:
- GOPROXY=https://proxy.golang.org
matrix:
include:
- go: 1.12.9
- language: python
before_install: pip install flake8
script: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
name: Check Boilerplate
env:
- TESTSUITE=boilerplate
before_install:
- pip install flake8 && flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
script: make test
before_install:
- sudo apt-get install -y libvirt-dev
install:
- echo "Don't run anything."
script:
- make test
- language: go
name: Code Lint
go: 1.12.9
env:
- TESTSUITE=lint
before_install:
- sudo apt-get install -y libvirt-dev
script: make test
- language: go
name: Unit Test
go: 1.12.9
env:
- TESTSUITE=unittest
before_install:
- sudo apt-get install -y libvirt-dev
script: make test
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:

72
test.sh
View File

@ -16,40 +16,52 @@
set -eu -o pipefail
TESTSUITE="${TESTSUITE:-all}" # if env variable not set run all the tests
exitcode=0
echo "= go mod ================================================================"
go mod download 2>&1 | grep -v "go: finding" || true
go mod tidy -v && echo ok || ((exitcode += 2))
echo "= make lint ============================================================="
make -s lint-ci && echo ok || ((exitcode += 4))
echo "= boilerplate ==========================================================="
readonly PYTHON=$(type -P python || echo docker run --rm -it -v $(pwd):/minikube -w /minikube python python)
readonly BDIR="./hack/boilerplate"
missing="$($PYTHON ${BDIR}/boilerplate.py --rootdir . --boilerplate-dir ${BDIR} | egrep -v '/assets.go|/translations.go|/site/themes/|/site/node_modules|\./out|/hugo/' || true)"
if [[ -n "${missing}" ]]; then
echo "boilerplate missing: $missing"
echo "consider running: ${BDIR}/fix.sh"
((exitcode += 4))
else
echo "ok"
if [[ "$TESTSUITE" = "lint" ]] || [[ "$TESTSUITE" = "all" ]]
then
echo "= make lint ============================================================="
make -s lint-ci && echo ok || ((exitcode += 4))
echo "= go mod ================================================================"
go mod download 2>&1 | grep -v "go: finding" || true
go mod tidy -v && echo ok || ((exitcode += 2))
fi
echo "= schema_check =========================================================="
go run deploy/minikube/schema_check.go >/dev/null && echo ok || ((exitcode += 8))
echo "= go test ==============================================================="
cov_tmp="$(mktemp)"
readonly COVERAGE_PATH=./out/coverage.txt
echo "mode: count" >"${COVERAGE_PATH}"
pkgs=$(go list -f '{{ if .TestGoFiles }}{{.ImportPath}}{{end}}' ./cmd/... ./pkg/... | xargs)
go test \
-tags "container_image_ostree_stub containers_image_openpgp" \
-covermode=count \
-coverprofile="${cov_tmp}" \
${pkgs} && echo ok || ((exitcode += 16))
tail -n +2 "${cov_tmp}" >>"${COVERAGE_PATH}"
if [[ "$TESTSUITE" = "boilerplate" ]] || [[ "$TESTSUITE" = "all" ]]
then
echo "= boilerplate ==========================================================="
readonly PYTHON=$(type -P python || echo docker run --rm -it -v $(pwd):/minikube -w /minikube python python)
readonly BDIR="./hack/boilerplate"
missing="$($PYTHON ${BDIR}/boilerplate.py --rootdir . --boilerplate-dir ${BDIR} | egrep -v '/assets.go|/translations.go|/site/themes/|/site/node_modules|\./out|/hugo/' || true)"
if [[ -n "${missing}" ]]; then
echo "boilerplate missing: $missing"
echo "consider running: ${BDIR}/fix.sh"
((exitcode += 8))
else
echo "ok"
fi
fi
if [[ "$TESTSUITE" = "unittest" ]] || [[ "$TESTSUITE" = "all" ]]
then
echo "= schema_check =========================================================="
go run deploy/minikube/schema_check.go >/dev/null && echo ok || ((exitcode += 16))
echo "= go test ==============================================================="
cov_tmp="$(mktemp)"
readonly COVERAGE_PATH=./out/coverage.txt
echo "mode: count" >"${COVERAGE_PATH}"
pkgs=$(go list -f '{{ if .TestGoFiles }}{{.ImportPath}}{{end}}' ./cmd/... ./pkg/... | xargs)
go test \
-tags "container_image_ostree_stub containers_image_openpgp" \
-covermode=count \
-coverprofile="${cov_tmp}" \
${pkgs} && echo ok || ((exitcode += 32))
tail -n +2 "${cov_tmp}" >>"${COVERAGE_PATH}"
fi
exit "${exitcode}"