diff --git a/.gitignore b/.gitignore index a2aa729a..7f352b8a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ release *.exe .env .bundle +c.out # Go.gitignore # Compiled Object files, Static and Dynamic libs (Shared Objects) diff --git a/.travis.yml b/.travis.yml index 0eef19c7..8b39182a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,20 @@ language: go go: - 1.14.x +env: + - COVER=true install: # Fetch dependencies - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.24.0 - GO111MODULE=on go mod download + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter +before_script: + - ./cc-test-reporter before-build script: - make test +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -t gocov sudo: false notifications: email: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 5225d798..d52b9e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ ## Changes since v5.1.1 +- [#533](https://github.com/oauth2-proxy/oauth2-proxy/pull/487) Set up code coverage within Travis for Code Climate (@JoelSpeed) - [#514](https://github.com/oauth2-proxy/oauth2-proxy/pull/514) Add basic string functions to templates - [#524](https://github.com/oauth2-proxy/oauth2-proxy/pull/524) Sign cookies with SHA256 (@NickMeves) - [#515](https://github.com/oauth2-proxy/oauth2-proxy/pull/515) Drop configure script in favour of native Makefile env and checks (@JoelSpeed) diff --git a/Makefile b/Makefile index e0a0c700..55984e60 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,10 @@ MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1 MINIMUM_SUPPORTED_GO_MINOR_VERSION = 14 GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION) +ifeq ($(COVER),true) +TESTCOVER ?= -coverprofile c.out +endif + .PHONY: all all: lint $(BINARY) @@ -65,7 +69,7 @@ docker-push-all: docker-push .PHONY: test test: lint - GO111MODULE=on $(GO) test -v -race ./... + GO111MODULE=on $(GO) test $(TESTCOVER) -v -race ./... .PHONY: release release: lint test diff --git a/README.md b/README.md index c1ee12be..d912fa7e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/oauth2-proxy/oauth2-proxy)](https://goreportcard.com/report/github.com/oauth2-proxy/oauth2-proxy) [![GoDoc](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy?status.svg)](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) +[![Maintainability](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/maintainability)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/a58ff79407212e2beacb/test_coverage)](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/test_coverage) A reverse proxy and static file server that provides authentication using Providers (Google, GitHub, and others) to validate accounts by email, domain or group.