-
Notifications
You must be signed in to change notification settings - Fork 22
140 lines (132 loc) · 3.65 KB
/
gotest.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
---
name: checks
on:
push:
branches:
- main
pull_request:
env:
# this must match the version in mk/0_initial.mk
GO_SVR: 1.19.6
jobs:
commit:
name: "💾 Commit message"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
path: code
- uses: actions/checkout@v3
with:
repository: "RHEnVision/changelog"
path: changelog
- run: pip3 install ./changelog
- run: |
make check-commits
working-directory: code
build:
name: "🛠️ Go Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
cache: true
- name: Build all artifacts
run: |
make check-system-go build GO=go
lint:
name: "🎯 Code format & OpenAPI lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go or cache prefix is added
cache: false
- uses: actions/cache@v3
id: cache
with:
path: bin
key: bin-go${{ env.GO_SVR }}-tools-${{ hashFiles('mk/tools.mk') }}
- name: Install Go Tools
if: steps.cache.outputs.cache-hit != 'true'
run: make install-tools GO=go
- name: Generate and validate
run: |
touch config/_config.yaml
make check-system-go check-fmt validate GO=go
golint:
name: "🎯 Go linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled because golangci linter caches Go packages and modules
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
testing:
name: "📎 Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until lookup-only or cache prefix is added
# (https://github.com/actions/setup-go/issues/316)
cache: false
- run: |
make check-system-go test GO=go
test-dao:
name: "🗄 Integration tests"
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: foobar
POSTGRES_DB: provisioning_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until lookup-only or cache prefix is added
# (https://github.com/actions/setup-go/issues/316)
cache: false
- name: "Run tests"
env:
DATABASE_USER: postgres
DATABASE_PASSWORD: foobar
DATABASE_NAME: provisioning_test
WORKER_QUEUE: redis
run: make check-system-go integration-test check-migrations GO=go