2022-07-17 16:25:56 +00:00
|
|
|
variables:
|
2023-03-20 23:48:15 +00:00
|
|
|
- &golang_image 'golang:1.20.2'
|
2022-07-17 16:25:56 +00:00
|
|
|
- &when_path
|
|
|
|
# related config files
|
|
|
|
- ".woodpecker/test.yml"
|
|
|
|
- ".golangci.yml"
|
|
|
|
# go source code
|
|
|
|
- "**/*.go"
|
|
|
|
- "go.*"
|
|
|
|
# schema changes
|
|
|
|
- "pipeline/schema/**"
|
|
|
|
|
2023-06-07 10:04:37 +00:00
|
|
|
pipeline: &legacy
|
2022-08-14 17:04:19 +00:00
|
|
|
vendor:
|
|
|
|
image: *golang_image
|
|
|
|
group: prepare
|
|
|
|
commands:
|
|
|
|
- go mod vendor
|
|
|
|
when:
|
|
|
|
path: *when_path
|
|
|
|
|
2022-05-17 15:59:51 +00:00
|
|
|
lint-pipeline:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2022-05-17 15:59:51 +00:00
|
|
|
commands:
|
2022-07-17 16:25:56 +00:00
|
|
|
- go run github.com/woodpecker-ci/woodpecker/cmd/cli lint
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
|
|
|
path:
|
|
|
|
- ".woodpecker/**"
|
2022-07-19 13:06:08 +00:00
|
|
|
- "pipeline/schema/**"
|
2022-05-17 15:59:51 +00:00
|
|
|
|
2021-11-30 16:46:19 +00:00
|
|
|
dummy-web:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2022-06-16 23:57:02 +00:00
|
|
|
group: prepare
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
|
|
|
- mkdir -p web/dist/
|
|
|
|
- echo "test" > web/dist/index.html
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
lint:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2021-11-30 16:46:19 +00:00
|
|
|
group: test
|
|
|
|
commands:
|
|
|
|
- make lint
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
2023-06-03 19:38:36 +00:00
|
|
|
check_swagger:
|
|
|
|
image: *golang_image
|
|
|
|
group: test
|
|
|
|
commands:
|
|
|
|
- "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:
|
|
|
|
path: *when_path
|
|
|
|
|
2022-06-17 10:03:34 +00:00
|
|
|
lint-editorconfig:
|
|
|
|
image: mstruebing/editorconfig-checker
|
|
|
|
group: test
|
|
|
|
|
2023-05-14 08:31:39 +00:00
|
|
|
# Fixed with https://github.com/woodpecker-ci/woodpecker/pull/1753
|
|
|
|
# securitycheck:
|
|
|
|
# group: test
|
|
|
|
# image: aquasec/trivy:latest
|
|
|
|
# commands:
|
|
|
|
# - trivy fs --exit-code 0 --skip-dirs web/ --skip-dirs docs/ --severity UNKNOWN,LOW .
|
|
|
|
# - trivy fs --exit-code 1 --skip-dirs web/ --skip-dirs docs/ --severity MEDIUM,HIGH,CRITICAL .
|
|
|
|
# when:
|
|
|
|
# path: *when_path
|
2022-09-03 18:46:48 +00:00
|
|
|
|
2021-12-07 00:13:31 +00:00
|
|
|
test:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2021-11-30 16:46:19 +00:00
|
|
|
group: test
|
|
|
|
commands:
|
|
|
|
- make test-agent
|
|
|
|
- make test-server
|
|
|
|
- make test-cli
|
|
|
|
- make test-lib
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
sqlite:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2021-11-30 16:46:19 +00:00
|
|
|
group: test
|
|
|
|
environment:
|
2021-12-20 15:15:21 +00:00
|
|
|
- WOODPECKER_DATABASE_DRIVER=sqlite3
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-02-01 18:34:56 +00:00
|
|
|
- make test-server-datastore-coverage
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
postgres:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2021-11-30 16:46:19 +00:00
|
|
|
group: test
|
|
|
|
environment:
|
2021-12-20 15:15:21 +00:00
|
|
|
- WOODPECKER_DATABASE_DRIVER=postgres
|
|
|
|
- WOODPECKER_DATABASE_DATASOURCE=host=service-postgres user=postgres dbname=postgres sslmode=disable
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
|
|
|
- make test-server-datastore
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
mysql:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *golang_image
|
2021-11-30 16:46:19 +00:00
|
|
|
group: test
|
|
|
|
environment:
|
2021-12-20 15:15:21 +00:00
|
|
|
- WOODPECKER_DATABASE_DRIVER=mysql
|
|
|
|
- WOODPECKER_DATABASE_DATASOURCE=root@tcp(service-mysql:3306)/test?parseTime=true
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
|
|
|
- make test-server-datastore
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2021-11-30 16:46:19 +00:00
|
|
|
|
2022-02-01 18:34:56 +00:00
|
|
|
codecov:
|
|
|
|
pull: true
|
|
|
|
image: woodpeckerci/plugin-codecov:next-alpine
|
|
|
|
settings:
|
|
|
|
files:
|
|
|
|
- agent-coverage.out
|
|
|
|
- cli-coverage.out
|
2022-10-01 09:51:04 +00:00
|
|
|
- coverage.out
|
2022-02-01 18:34:56 +00:00
|
|
|
- server-coverage.out
|
|
|
|
- datastore-coverage.out
|
|
|
|
token:
|
|
|
|
from_secret: codecov_token
|
2022-05-20 03:31:19 +00:00
|
|
|
when:
|
2022-07-17 16:25:56 +00:00
|
|
|
path: *when_path
|
2023-03-21 19:00:45 +00:00
|
|
|
failure: ignore
|
2022-02-01 18:34:56 +00:00
|
|
|
|
2021-11-30 16:46:19 +00:00
|
|
|
services:
|
2021-12-07 00:13:31 +00:00
|
|
|
service-postgres:
|
2022-01-08 19:21:22 +00:00
|
|
|
image: postgres:11
|
2021-11-30 16:46:19 +00:00
|
|
|
ports: ["5432"]
|
|
|
|
environment:
|
|
|
|
- POSTGRES_USER=postgres
|
|
|
|
- POSTGRES_HOST_AUTH_METHOD=trust
|
2022-10-14 11:38:03 +00:00
|
|
|
when:
|
|
|
|
path: *when_path
|
2022-01-29 12:58:55 +00:00
|
|
|
|
2021-12-07 00:13:31 +00:00
|
|
|
service-mysql:
|
2021-11-30 16:46:19 +00:00
|
|
|
image: mysql:5.6.27
|
|
|
|
ports: ["3306"]
|
|
|
|
environment:
|
|
|
|
- MYSQL_DATABASE=test
|
|
|
|
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
2022-10-14 11:38:03 +00:00
|
|
|
when:
|
|
|
|
path: *when_path
|
2023-06-07 10:04:37 +00:00
|
|
|
|
|
|
|
steps: *legacy
|