-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (77 loc) · 2.04 KB
/
server-main.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
name: Server CI/CD
on:
push:
paths:
- 'build/server.dockerfile'
- 'cmd/server/**'
- 'internal/**'
- 'pkg/**'
- 'migrations/**'
- 'queries/**'
- 'web/**'
- '.github/workflows/server-main.yml'
branches:
- main
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Setup protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v3
with:
sqlc-version: '1.26.0'
- name: Setup tools
run: |
go install go.uber.org/mock/mockgen@latest
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
- name: Generate files
run: make generate
- name: Go test
run: go test ./... -race
docker:
name: Deliver
needs: test
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Setup protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v3
with:
sqlc-version: '1.26.0'
- name: Setup tools
run: |
go install go.uber.org/mock/mockgen@latest
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
- name: Generate files
run: make gen
- name: Login to GHCR
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u flohansen --password-stdin
- name: Docker build
run: |
docker build -t ghcr.io/flohansen/dasher-server:latest -f build/server.dockerfile .
- name: Docker push
run: |
docker push ghcr.io/flohansen/dasher-server:latest