mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-26 16:21:55 -06:00
Split travis into multiple jobs (#322)
The motivation for this is to make it easier to see whether a travis failure is due to linting, unit tests or integration test failures, without having to look in the logs. It also means that each job is independent, so if e.g. the linting fails then the unit tests will still be run.
This commit is contained in:
parent
bad701c703
commit
dc782ec399
14
.travis.yml
14
.travis.yml
|
@ -1,6 +1,12 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- 1.8
|
- 1.8
|
||||||
|
- 1.9
|
||||||
|
|
||||||
|
env:
|
||||||
|
- TEST_SUITE="lint"
|
||||||
|
- TEST_SUITE="unit-test"
|
||||||
|
- TEST_SUITE="integ-test"
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
@ -8,9 +14,6 @@ sudo: false
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- openssl
|
|
||||||
postgresql: "9.5"
|
postgresql: "9.5"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
@ -19,12 +22,7 @@ services:
|
||||||
install:
|
install:
|
||||||
- go get github.com/constabulary/gb/...
|
- go get github.com/constabulary/gb/...
|
||||||
|
|
||||||
# Generate a self-signed X.509 certificate for TLS.
|
|
||||||
before_script:
|
|
||||||
- openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes -subj /CN=localhost
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./scripts/install-local-kafka.sh
|
|
||||||
- ./scripts/travis-test.sh
|
- ./scripts/travis-test.sh
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
|
|
@ -19,8 +19,5 @@ go build github.com/matrix-org/dendrite/cmd/...
|
||||||
|
|
||||||
./scripts/find-lint.sh
|
./scripts/find-lint.sh
|
||||||
|
|
||||||
echo "Double checking spelling..."
|
|
||||||
misspell -error src *.md
|
|
||||||
|
|
||||||
echo "Testing..."
|
echo "Testing..."
|
||||||
gb test
|
gb test
|
||||||
|
|
|
@ -31,7 +31,7 @@ then args="$args --enable-gc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing lint search engine..."
|
echo "Installing lint search engine..."
|
||||||
go install github.com/alecthomas/gometalinter/
|
gb build github.com/alecthomas/gometalinter/
|
||||||
gometalinter --config=linter.json ./... --install
|
gometalinter --config=linter.json ./... --install
|
||||||
|
|
||||||
echo "Looking for lint..."
|
echo "Looking for lint..."
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# The entry point for travis tests
|
# The entry point for travis tests
|
||||||
|
#
|
||||||
|
# TEST_SUITE env var can be set to "lint", "unit-test" or "integ-test", in
|
||||||
|
# which case only the linting, unit tests or integration tests will be run
|
||||||
|
# respectively. If not specified or null all tests are run.
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
@ -8,20 +12,44 @@ set -eu
|
||||||
export GOGC=400
|
export GOGC=400
|
||||||
export DENDRITE_LINT_DISABLE_GC=1
|
export DENDRITE_LINT_DISABLE_GC=1
|
||||||
|
|
||||||
# Check that the servers build (this is done explicitly because `gb build` can silently fail (exit 0) and then we'd test a stale binary)
|
export GOPATH="$(pwd):$(pwd)/vendor"
|
||||||
gb build github.com/matrix-org/dendrite/cmd/dendrite-room-server
|
export PATH="$PATH:$(pwd)/vendor/bin:$(pwd)/bin"
|
||||||
gb build github.com/matrix-org/dendrite/cmd/roomserver-integration-tests
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/syncserver-integration-tests
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/create-account
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/dendrite-media-api-server
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests
|
|
||||||
gb build github.com/matrix-org/dendrite/cmd/client-api-proxy
|
|
||||||
|
|
||||||
# Run unit tests and linters
|
if [ "${TEST_SUITE:-lint}" == "lint" ]; then
|
||||||
./scripts/build-test-lint.sh
|
./scripts/find-lint.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the integration tests
|
if [ "${TEST_SUITE:-unit-test}" == "unit-test" ]; then
|
||||||
bin/roomserver-integration-tests
|
gb test
|
||||||
bin/syncserver-integration-tests
|
fi
|
||||||
bin/mediaapi-integration-tests
|
|
||||||
|
if [ "${TEST_SUITE:-integ-test}" == "integ-test" ]; then
|
||||||
|
gb build
|
||||||
|
|
||||||
|
# Check that all the packages can build.
|
||||||
|
# When `go build` is given multiple packages it won't output anything, and just
|
||||||
|
# checks that everything builds. This seems to do a better job of handling
|
||||||
|
# missing imports than `gb build` does.
|
||||||
|
go build github.com/matrix-org/dendrite/cmd/...
|
||||||
|
|
||||||
|
# Check that the servers build (this is done explicitly because `gb build` can silently fail (exit 0) and then we'd test a stale binary)
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/dendrite-room-server
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/roomserver-integration-tests
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/dendrite-sync-api-server
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/syncserver-integration-tests
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/create-account
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/dendrite-media-api-server
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/mediaapi-integration-tests
|
||||||
|
gb build github.com/matrix-org/dendrite/cmd/client-api-proxy
|
||||||
|
|
||||||
|
# Create necessary certificates and keys to run dendrite
|
||||||
|
echo "Generating certs..."
|
||||||
|
time openssl req -x509 -newkey rsa:512 -keyout server.key -out server.crt -days 365 -nodes -subj /CN=localhost
|
||||||
|
echo "Installing kafka..."
|
||||||
|
time ./scripts/install-local-kafka.sh
|
||||||
|
|
||||||
|
# Run the integration tests
|
||||||
|
bin/roomserver-integration-tests
|
||||||
|
bin/syncserver-integration-tests
|
||||||
|
bin/mediaapi-integration-tests
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue