142 lines (129 loc) · 3.98 KB
/
testing.yml
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
name: Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- created
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
test:
name: Test
runs-on: ubuntu-latest
needs: [ lint ]
services:
pg-pq:
image: postgres:9.6-alpine
ports:
- "5432"
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
pg-pgx4:
image: postgres:9.6-alpine
ports:
- "5432"
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbit:
image: rabbitmq:3.6-management-alpine
ports:
- "5672"
- "15672"
options: >-
--health-cmd "rabbitmqctl status"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:3.2-alpine
ports:
- "6379"
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongo:
image: mongo:3
ports:
- "27017"
options: >-
--health-cmd "mongo localhost:27017/test --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
ports:
- "3306"
env:
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD"
--health-interval 10s
--health-timeout 5s
--health-retries 5
http:
image: pierreprinetti/apimock:latest
ports:
- "8080"
env:
HOST: ":8080"
memcached:
image: memcached:1.6.9-alpine
ports:
- "11211"
influxdb:
image: influxdb:1.8-alpine
ports:
- "8086"
env:
DOCKER_INFLUXDB_INIT_USERNAME: test
DOCKER_INFLUXDB_INIT_PASSWORD: test
DOCKER_INFLUXDB_INIT_ORG: test
DOCKER_INFLUXDB_INIT_BUCKET: test
steps:
- name: Set up Go
uses: actions/setup-go@v2
- name: Check out code
uses: actions/checkout@v2
- name: Run tests
if: success()
run: go test -cover ./... -coverprofile=coverage.txt -covermode=atomic
env:
HEALTH_GO_PG_PQ_DSN: postgres://test:test@localhost:${{ job.services.pg-pq.ports[5432] }}/test?sslmode=disable
HEALTH_GO_PG_PGX4_DSN: postgres://test:test@localhost:${{ job.services.pg-pgx4.ports[5432] }}/test?sslmode=disable
HEALTH_GO_MQ_DSN: amqp://guest:guest@localhost:${{ job.services.rabbit.ports[5672] }}/
HEALTH_GO_MQ_URL: http://guest:guest@localhost:${{ job.services.rabbit.ports[15672] }}/
HEALTH_GO_RD_DSN: redis://localhost:${{ job.services.redis.ports[6379] }}/
HEALTH_GO_MG_DSN: mongodb://localhost:${{ job.services.mongo.ports[27017] }}/
HEALTH_GO_MS_DSN: test:test@tcp(localhost:${{ job.services.mysql.ports[3306] }})/test?charset=utf8
HEALTH_GO_HTTP_URL: http://localhost:${{ job.services.http.ports[8080] }}/status
HEALTH_GO_INFLUXDB_URL: http://localhost:${{ job.services.influxdb.ports[8086] }}
HEALTH_GO_MD_DSN: memcached://localhost:${{ job.services.memcached.ports[11211] }}/