woodpecker/.woodpecker/test.yml

160 lines
3.4 KiB
YAML
Raw Normal View History

version: 1
when:
- event: [pull_request, tag]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
- renovate/*
variables:
- &golang_image 'docker.io/golang:1.21.4'
- &when
2023-10-24 12:42:05 +00:00
- path: &when_path # related config files
- '.woodpecker/test.yml'
- '.golangci.yml'
# go source code
2023-10-24 12:42:05 +00:00
- '**/*.go'
- 'go.*'
# schema changes
2023-10-24 12:42:05 +00:00
- 'pipeline/schema/**'
event: [pull_request, tag]
steps:
vendor:
image: *golang_image
group: prepare
commands:
- go mod vendor
when:
- path: *when_path
2022-05-17 15:59:51 +00:00
lint-pipeline:
image: *golang_image
2022-05-17 15:59:51 +00:00
commands:
- go run go.woodpecker-ci.org/woodpecker/v2/cmd/cli lint
when:
- <<: *when
- path:
2023-10-24 12:42:05 +00:00
- '.woodpecker/**'
- 'pipeline/schema/**'
2022-05-17 15:59:51 +00:00
dummy-web:
image: *golang_image
group: prepare
commands:
- mkdir -p web/dist/
- echo "test" > web/dist/index.html
2023-10-14 12:07:46 +00:00
when:
- path: *when_path
lint:
image: *golang_image
group: test
commands:
- make lint
when: *when
check_swagger:
image: *golang_image
group: test
commands:
2023-10-24 12:42:05 +00:00
- 'make generate-swagger'
- 'DIFF=$(git diff | head)'
- '[ -n "$DIFF" ] && { echo "swagger not up to date, exec `make generate-swagger` and commit"; exit 1; } || true'
when: *when
2022-06-17 10:03:34 +00:00
lint-editorconfig:
image: docker.io/mstruebing/editorconfig-checker:2.7.2
2022-06-17 10:03:34 +00:00
group: test
when:
- event: [pull_request, tag]
2022-06-17 10:03:34 +00:00
lint-license-header:
image: *golang_image
group: test
commands:
- go install github.com/google/addlicense@latest
2023-10-24 12:42:05 +00:00
- 'addlicense -check -ignore "vendor/**" **/*.go'
when: *when
prettier:
image: docker.io/woodpeckerci/plugin-prettier:next
2023-10-24 12:42:05 +00:00
group: test
when: *when
2021-12-07 00:13:31 +00:00
test:
image: *golang_image
group: test
commands:
- make test-agent
- make test-server
- make test-cli
- make test-lib
when:
- path: *when_path
sqlite:
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=sqlite3
commands:
- make test-server-datastore-coverage
when:
- path: *when_path
postgres:
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=postgres
- WOODPECKER_DATABASE_DATASOURCE=host=service-postgres user=postgres dbname=postgres sslmode=disable
commands:
- make test-server-datastore
when: *when
mysql:
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=mysql
- WOODPECKER_DATABASE_DATASOURCE=root@tcp(service-mysql:3306)/test?parseTime=true
commands:
- make test-server-datastore
when: *when
codecov:
pull: true
image: docker.io/woodpeckerci/plugin-codecov:2.1.2
settings:
files:
- agent-coverage.out
- cli-coverage.out
- coverage.out
- server-coverage.out
- datastore-coverage.out
token:
from_secret: codecov_token
when:
- path: *when_path
failure: ignore
services:
2021-12-07 00:13:31 +00:00
service-postgres:
image: docker.io/postgres:16
2023-10-24 12:42:05 +00:00
ports: ['5432']
environment:
- POSTGRES_USER=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
when: *when
2021-12-07 00:13:31 +00:00
service-mysql:
image: docker.io/mysql:8.2.0
2023-10-24 12:42:05 +00:00
ports: ['3306']
environment:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
when: *when