-
Notifications
You must be signed in to change notification settings - Fork 6
161 lines (133 loc) · 4.15 KB
/
pipeline.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Verify
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch: # Handy for testing
jobs:
quesma-test-and-compile:
strategy:
matrix:
module: [ "quesma" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: ${{ matrix.module }}/go.sum
go-version: '1.22'
- name: gofmt
working-directory: ${{ matrix.module }}
run: gofmt -l -d . | (! grep . -q) || (gofmt -l -d .;exit 1)
- name: Go Vet
working-directory: ${{ matrix.module }}
run: go vet ./...
- uses: dominikh/[email protected]
with:
version: "2023.1.6"
install-go: false
working-directory: ${{ matrix.module }}
- name: Build
working-directory: ${{ matrix.module }}
run: go build -v ./...
- name: Test (without race detection)
working-directory: ${{ matrix.module }}
run: go run gotest.tools/gotestsum@latest --format pkgname-and-test-fails ./...
build-quesma-docker-image:
strategy:
matrix:
module: [ "quesma" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: ${{ matrix.module }}/go.sum
go-version: '1.22'
- name: Build and export
uses: docker/build-push-action@v5
with:
context: ${{ matrix.module }}/.
tags: ${{ matrix.module }}:latest
outputs: type=docker,dest=/tmp/image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.module }}
path: /tmp/image.tar
retention-days: 1
build-log-generator:
strategy:
matrix:
module: [ "log-generator" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: ${{ matrix.module }}/go.sum
go-version: '1.22'
- name: Build and export
uses: docker/build-push-action@v5
with:
context: docker/${{ matrix.module }}/.
tags: ${{ matrix.module }}:latest
outputs: type=docker,dest=/tmp/image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.module }}
path: /tmp/image.tar
retention-days: 1
smoke-test:
runs-on: ubuntu-latest
needs: [build-log-generator, build-quesma-docker-image]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: smoke-test/go.sum
go-version: '1.22'
- name: Download images
uses: actions/download-artifact@v4
with:
path: /tmp/images
- name: Load images
run: |
for file in /tmp/images/*/*.tar; do
docker load --input $file
done
docker image ls -a
- name: Build and start docker-compose
timeout-minutes: 10
run: docker-compose -f docker/ci.yml up -d
- name: Wait until services are healthy
timeout-minutes: 6
working-directory: smoke-test
run: go run . --wait-for-start
- name: Verify if data is flowing
working-directory: smoke-test
env:
GITHUB_ACTIONS: true
run: go run .
- name: Print docker status
if: failure()
run: docker-compose -f docker/ci.yml ps
- name: Print docker-compose logs
if: failure()
run: docker-compose -f docker/ci.yml logs