elvish/.cirrus.yml
Kurtis Rader ad558b1e0d Include cross-package invocations in test coverage
The default behavior of `go test -cover` ignores coverage by integration
tests. That is, it ignores coverage by tests in a different package. This
penalizes Elvish since Elvish has a lot of integration tests that are
meant to indirectly, but explicitly, exercise code in other packages that
do not have explicit unit tests.

This change makes the test coverage more accurate for the purposes of
this project.

Resolves 
Resolves 
2021-01-03 02:05:44 +00:00

87 lines
2.8 KiB
YAML

test_task:
env:
ELVISH_TEST_TIME_SCALE: 20
CODECOV_TOKEN: e10d2e99-591b-4d2a-a8cf-8ca3e8d6df61
TEST_FLAG: -race
go_modules_cache:
fingerprint_script: cat go.sum
folder: $GOPATH/pkg/mod
matrix:
- name: Test on Linux
container:
image: golang:latest
- name: Test on Linux (Old Supported Go Version)
container:
image: golang:1.14
env:
# This should have the same coverage as the previous task, so skip it.
SKIP_UPLOAD_COVERAGE: 1
- name: Test on Linux (Gccgo)
container:
image: debian:unstable-slim
setup_script:
- apt-get -y update
- apt-get -y install ca-certificates gccgo-go
env:
# This should have the same coverage as the previous task, so skip it.
SKIP_UPLOAD_COVERAGE: 1
# Gccgo doesn't support race test
TEST_FLAG: ""
# Gccgo is buggy. Allow failures until it could reliably build and test
# Elvish.
allow_failures: true
- name: Test on macOS
osx_instance:
image: catalina-base
setup_script: brew install go
env:
GOPATH: $HOME/go
- name: Test on FreeBSD
freebsd_instance:
image_family: freebsd-12-1
setup_script: pkg install -y go bash
env:
GOPATH: $HOME/go
# For some reason the FreeBSD runner often has problem reaching codecov.
# Skip it to prevent the coverage from fluctuating, and make the FreeBSD
# task faster. There are very few files that are built on FreeBSD but not
# Linux, so losing this part of the data makes very little difference.
SKIP_UPLOAD_COVERAGE: 1
go_version_script: go version
test_script: go test $TEST_FLAG ./...
upload_coverage_script:
- test -z $SKIP_UPLOAD_COVERAGE || exit 0
- go test -coverprofile=cover -coverpkg=./pkg/... ./pkg/...
- curl -s https://codecov.io/bash -o codecov && bash codecov -f cover -t $CODECOV_TOKEN || true
checkstyle_go_task:
name: Check the style of .go files
container:
image: golang:latest
env:
PATH: $HOME/go/bin:$PATH
setup_script: go get golang.org/x/tools/cmd/goimports
check_script: make checkstyle-go
checkstyle_md_task:
name: Check the style of .md files
container:
image: node:latest
env:
PATH: $HOME/.npm-packages/bin:$PATH
setup_script: npm install --global prettier@2.0.5
check_script: make checkstyle-md
deploy_task:
name: Build binaries and deploy to bintray
only_if: $CIRRUS_PR == ""
env:
BINTRAY_TOKEN: ENCRYPTED[1a1820d17a2014de6b1798d379f86aa24bbd8acd5149656a98bfdf33746c78c85fefc8e6e522fedacdf8c4bf92bb25a0]
go_modules_cache:
fingerprint_script: cat go.sum
folder: $GOPATH/pkg/mod
container:
image: theelves/cirrus-builder
go_version_script: go version
deploy_script: ./tools/cirrus-deploy.sh