diff --git a/.travis.yml b/.travis.yml index 400b1a34..aa6ff5b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,15 +37,13 @@ install: - npm install -g sass - npm install -g newman - pip install --user awscli -- go mod vendor -- make dev-deps +- go mod download - make install before_script: - mysql -e 'CREATE DATABASE IF NOT EXISTS test;' - psql -c 'create database test;' -U postgres script: -- travis_retry make test-all -- make test-api +- travis_retry make test-ci - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make coverage; fi after_success: diff --git a/Makefile b/Makefile index 85c93c17..63eb7466 100644 --- a/Makefile +++ b/Makefile @@ -30,11 +30,21 @@ reup: down clean compose-build-full up test: clean go test -v -p=4 -ldflags="-X main.VERSION=testing" -coverprofile=coverage.out ./... +# build all arch's and release Statping +release: + wget -O statping.gpg $(SIGN_URL) + gpg --import statping.gpg + make build-all + test-ci: clean compile test-deps SASS=`which sass` STATPING_DIR=${GOPATH}/src/github.com/statping/statping go test -v -covermode=count -coverprofile=coverage.out -p=4 ./... goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS bash <(curl -s https://codecov.io/bash) +test-api: + DB_CONN=sqlite DB_HOST=localhost DB_DATABASE=sqlite DB_PASS=none DB_USER=none statping & + sleep 5000 && newman run source/tmpl/postman.json -e dev/postman_environment.json --delay-request 500 + test-deps: go get golang.org/x/tools/cmd/cover go get github.com/mattn/goveralls @@ -162,6 +172,14 @@ print_details: build-all: xgo-install build-mac build-linux build-windows build-linux build-alpine compress +coverage: test-deps + $(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS) + +# build Statping using a travis ci trigger +travis-build: travis_s3_creds upload_to_s3 + curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $(TRAVIS_API)" -d $(TRAVIS_BUILD_CMD) https://api.travis-ci.com/repo/statping%2Fstatping/requests + curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST $(DOCKER) + download-key: wget -O statping.gpg $(KEY_URL) gpg --import statping.gpg