Add Codecov.io Upload (#660)

use https://github.com/woodpecker-ci/plugin-codecov to track code coverage on codecov.io
This commit is contained in:
6543 2022-02-01 19:34:56 +01:00 committed by GitHub
parent 616c262223
commit 7b2b884a0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 9 deletions

View file

@ -52,7 +52,7 @@ pipeline:
environment: environment:
- WOODPECKER_DATABASE_DRIVER=sqlite3 - WOODPECKER_DATABASE_DRIVER=sqlite3
commands: commands:
- make test-server-datastore - make test-server-datastore-coverage
when: when:
path: path:
# related config files # related config files
@ -93,6 +93,18 @@ pipeline:
- "**/*.go" - "**/*.go"
- "go.*" - "go.*"
codecov:
pull: true
image: woodpeckerci/plugin-codecov:next-alpine
settings:
files:
- agent-coverage.out
- cli-coverage.out
- server-coverage.out
- datastore-coverage.out
token:
from_secret: codecov_token
services: services:
service-postgres: service-postgres:
image: postgres:11 image: postgres:11

View file

@ -50,16 +50,19 @@ lint-frontend:
(cd web/; yarn lint --quiet) (cd web/; yarn lint --quiet)
test-agent: test-agent:
go test -race -cover -coverprofile coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/agent github.com/woodpecker-ci/woodpecker/agent/... go test -race -cover -coverprofile agent-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/agent github.com/woodpecker-ci/woodpecker/agent/...
test-server: test-server:
go test -race -cover -coverprofile coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/server $(shell go list github.com/woodpecker-ci/woodpecker/server/... | grep -v '/store') go test -race -cover -coverprofile server-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/server $(shell go list github.com/woodpecker-ci/woodpecker/server/... | grep -v '/store')
test-cli: test-cli:
go test -race -cover -coverprofile coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/cli github.com/woodpecker-ci/woodpecker/cli/... go test -race -cover -coverprofile cli-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/cmd/cli github.com/woodpecker-ci/woodpecker/cli/...
test-server-datastore: test-server-datastore:
go test -cover -coverprofile coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/... go test -race -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/...
test-server-datastore-coverage:
go test -race -cover -coverprofile datastore-coverage.out -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/...
test-frontend: frontend-dependencies test-frontend: frontend-dependencies
(cd web/; yarn run lint) (cd web/; yarn run lint)

View file

@ -8,6 +8,9 @@
<a href="https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker" title="Build Status"> <a href="https://ci.woodpecker-ci.org/woodpecker-ci/woodpecker" title="Build Status">
<img src="https://ci.woodpecker-ci.org/api/badges/woodpecker-ci/woodpecker/status.svg"> <img src="https://ci.woodpecker-ci.org/api/badges/woodpecker-ci/woodpecker/status.svg">
</a> </a>
<a href="https://codecov.io/gh/woodpecker-ci/woodpecker">
<img src="https://codecov.io/gh/woodpecker-ci/woodpecker/branch/master/graph/badge.svg"/>
</a>
<a href="https://discord.gg/fcMQqSMXJy" title="Join the Discord chat at https://discord.gg/fcMQqSMXJy"> <a href="https://discord.gg/fcMQqSMXJy" title="Join the Discord chat at https://discord.gg/fcMQqSMXJy">
<img src="https://img.shields.io/discord/838698813463724034.svg?label=discord"> <img src="https://img.shields.io/discord/838698813463724034.svg?label=discord">
</a> </a>

View file

@ -47,7 +47,7 @@ pipeline:
This is the reference list of all environment variables available to your pipeline containers. These are injected into your pipeline step and plugins containers, at runtime. This is the reference list of all environment variables available to your pipeline containers. These are injected into your pipeline step and plugins containers, at runtime.
| NAME | Description | | NAME | Description |
| ------------------------------ | -------------------------------------------------------------------------------------------- | |--------------------------------|----------------------------------------------------------------------------------------------|
| `CI=woodpecker` | environment is woodpecker | | `CI=woodpecker` | environment is woodpecker |
| | **Repository** | | | **Repository** |
| `CI_REPO` | repository full name `<owner>/<name>` | | `CI_REPO` | repository full name `<owner>/<name>` |
@ -63,7 +63,7 @@ This is the reference list of all environment variables available to your pipeli
| `CI_COMMIT_SHA` | commit sha | | `CI_COMMIT_SHA` | commit sha |
| `CI_COMMIT_REF` | commit ref | | `CI_COMMIT_REF` | commit ref |
| `CI_COMMIT_REFSPEC` | commit ref spec | | `CI_COMMIT_REFSPEC` | commit ref spec |
| `CI_COMMIT_BRANCH` | commit branch | | `CI_COMMIT_BRANCH` | commit branch (equals target branch for pull requests) |
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch | | `CI_COMMIT_SOURCE_BRANCH` | commit source branch |
| `CI_COMMIT_TARGET_BRANCH` | commit target branch | | `CI_COMMIT_TARGET_BRANCH` | commit target branch |
| `CI_COMMIT_TAG` | commit tag name (empty if event is not `tag`) | | `CI_COMMIT_TAG` | commit tag name (empty if event is not `tag`) |
@ -110,14 +110,14 @@ This is the reference list of all environment variables available to your pipeli
| `CI_PREV_BUILD_CREATED` | previous build created unix timestamp | | `CI_PREV_BUILD_CREATED` | previous build created unix timestamp |
| `CI_PREV_BUILD_STARTED` | previous build started unix timestamp | | `CI_PREV_BUILD_STARTED` | previous build started unix timestamp |
| `CI_PREV_BUILD_FINISHED` | previous build finished unix timestamp | | `CI_PREV_BUILD_FINISHED` | previous build finished unix timestamp |
| | &emsp; | | | &emsp; |
| `CI_WORKSPACE` | Path of the workspace where source code gets cloned to | | `CI_WORKSPACE` | Path of the workspace where source code gets cloned to |
| | **System** | | | **System** |
| `CI_SYSTEM_NAME` | name of the ci system: `woodpecker` | | `CI_SYSTEM_NAME` | name of the ci system: `woodpecker` |
| `CI_SYSTEM_LINK` | link to ci system | | `CI_SYSTEM_LINK` | link to ci system |
| `CI_SYSTEM_HOST` | hostname of ci server | | `CI_SYSTEM_HOST` | hostname of ci server |
| `CI_SYSTEM_VERSION` | version of the server | | `CI_SYSTEM_VERSION` | version of the server |
| | **Internal** - Please don't use! | | | **Internal** - Please don't use! |
| `CI_SCRIPT` | Internal script path. Used to call pipeline step commands. | | `CI_SCRIPT` | Internal script path. Used to call pipeline step commands. |
| `CI_NETRC_USERNAME` | Credentials for private repos to be able to clone data. (Only available for specific images) | | `CI_NETRC_USERNAME` | Credentials for private repos to be able to clone data. (Only available for specific images) |
| `CI_NETRC_PASSWORD` | Credentials for private repos to be able to clone data. (Only available for specific images) | | `CI_NETRC_PASSWORD` | Credentials for private repos to be able to clone data. (Only available for specific images) |