forked from darklynx/request-baskets
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (59 loc) · 1.68 KB
/
test.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
on:
pull_request:
types: [opened, reopened, labeled, synchronize]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ["1.18", "1.19", "1.20"]
# Service containers to run with `container-job`
services:
# we need PostgreSQL to run tests
postgres:
image: postgres
env:
POSTGRES_USER: rbaskets
POSTGRES_PASSWORD: pwd
POSTGRES_DB: baskets
ports:
- "5432:5432"
# set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# we need MySQL to run tests
mysql:
image: mysql
env:
MYSQL_DATABASE: baskets
MYSQL_USER: rbaskets
MYSQL_PASSWORD: pwd
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- "3306:3306"
# set health checks to wait until mysql has started
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v2
- run: go test -v -coverprofile=profile.cov
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
flag-name: Go-${{ matrix.go }}
parallel: true
# notifies that all test jobs are finished.
finish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true