diff --git a/.gitignore b/.gitignore index a2aa729aa4c1282ba1d95d79eda1a860aa0410ac..7f352b8a4c2c6889b14ac33837f04d7665608d32 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 0eef19c7cc8c8906a0eb6c26dedc7a8206444886..8b39182ad8187db375cb08738dcb14de4e3eada8 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 5225d798a20bb1080897f5133021a0da65da28b1..d52b9e344cde1cf6ff447b3b1aa44300d8614c16 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 e0a0c7001ce4d84aa5ad6713daaffd372616fe01..55984e603156457c96ff92e1440a909c80519e40 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 c1ee12bebd170ef9ade332145e41e423ba0d7bd0..d912fa7e6564704809870655f32cb1c50038f6da 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [](https://goreportcard.com/report/github.com/oauth2-proxy/oauth2-proxy) [](https://godoc.org/github.com/oauth2-proxy/oauth2-proxy) [](./LICENSE) +[](https://codeclimate.com/github/oauth2-proxy/oauth2-proxy/maintainability) +[](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.