forked from woodpecker-ci/woodpecker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.yaml
160 lines (146 loc) · 3.37 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
variables:
- &golang_image 'docker.io/golang:1.21.5'
- &when
- path: &when_path # related config files
- '.woodpecker/test.yaml'
- '.golangci.yaml'
# go source code
- '**/*.go'
- 'go.*'
# schema changes
- 'pipeline/schema/**'
event: pull_request
- event: push
branch: renovate/*
path: *when_path
when:
- event: pull_request
- event: push
branch: renovate/*
- event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
path: *when_path
steps:
vendor:
image: *golang_image
commands:
- go mod vendor
when:
path:
- <<: *when_path
- '.woodpecker/**'
lint-pipeline:
depends_on:
- vendor
image: *golang_image
commands:
- go run go.woodpecker-ci.org/woodpecker/v2/cmd/cli lint
environment:
WOODPECKER_DISABLE_UPDATE_CHECK: true
when:
- event: pull_request
path:
- '.woodpecker/**'
dummy-web:
image: *golang_image
commands:
- mkdir -p web/dist/
- echo "test" > web/dist/index.html
when:
- path: *when_path
lint:
depends_on:
- vendor
image: *golang_image
commands:
- make lint
when: *when
check-swagger:
depends_on:
- vendor
image: *golang_image
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: *when
lint-license-header:
image: *golang_image
commands:
- go install github.com/google/addlicense@latest
- 'addlicense -check -ignore "vendor/**" **/*.go'
when: *when
test:
depends_on:
- vendor
image: *golang_image
commands:
- make test-agent
- make test-server
- make test-cli
- make test-lib
when:
- path: *when_path
sqlite:
depends_on:
- vendor
image: *golang_image
environment:
WOODPECKER_DATABASE_DRIVER: sqlite3
commands:
- make test-server-datastore-coverage
when:
- path: *when_path
postgres:
depends_on:
- vendor
image: *golang_image
environment:
WOODPECKER_DATABASE_DRIVER: postgres
WOODPECKER_DATABASE_DATASOURCE: 'host=postgres user=postgres dbname=postgres sslmode=disable'
commands:
- make test-server-datastore
when: *when
mysql:
depends_on:
- vendor
image: *golang_image
environment:
WOODPECKER_DATABASE_DRIVER: mysql
WOODPECKER_DATABASE_DATASOURCE: root@tcp(mysql:3306)/test?parseTime=true
commands:
- make test-server-datastore
when: *when
codecov:
depends_on:
- test
- sqlite
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:
postgres:
image: docker.io/postgres:16
ports: ['5432']
environment:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
when: *when
mysql:
image: docker.io/mysql:8.2.0
ports: ['3306']
environment:
MYSQL_DATABASE: test
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
when: *when