-
Notifications
You must be signed in to change notification settings - Fork 7
91 lines (73 loc) · 2.43 KB
/
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
---
name: Validate
on:
- push
- pull_request
permissions:
contents: read
jobs:
validate:
# https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
services:
postgres:
image: quay.io/cloudservices/postgresql-rds:15
env:
POSTGRESQL_DATABASE: idmsvc-db
POSTGRESQL_USER: idmsvc-user
POSTGRESQL_PASSWORD: idmsvc-secret
ports:
- 5432:5432
runs-on: "ubuntu-latest"
container: golang:1.21
env:
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_NAME: idmsvc-db
DATABASE_USER: idmsvc-user
DATABASE_PASSWORD: idmsvc-secret
steps:
- uses: "actions/checkout@v4"
with:
submodules: recursive
- name: "Set git safe directory"
run: git config --system --add safe.directory $GITHUB_WORKSPACE
- name: Install package dependencies
run: |
apt-get update
apt-get install -y python3-venv python3-pip
python3 -m venv .venv
.venv/bin/pip install yamllint
- name: print go version
run: go version
- name: Install golang tools
run: make install-go-tools
- name: Install service dependencies
run: make get-deps
- name: Checking missed 'make tidy'
run: make tidy && git diff --exit-code go.mod go.sum
- name: Checking missed 'make generate-api'
run: make generate-api && git diff --exit-code internal/api/public/
- name: Checking missed 'make generate-mock'
run: make generate-mock && git diff --exit-code internal/test/mock/
- name: Checking missed 'go fmt'
run: make go-fmt && git diff --exit-code .
- name: Checking yaml files
run: .venv/bin/python3 -m yamllint .
- name: Run go vet
run: go vet $(go list ./... | grep -v /vendor/)
- name: Run tests
run: |
cp -vf configs/config.ci.yaml configs/config.yaml
make db-migrate-up
make test
- name: Process coverage report
run: |
go get github.com/boumenot/gocover-cobertura
go run github.com/boumenot/gocover-cobertura < coverage.out > coverage.xml
go tool cover -func ./coverage.out
- name: Upload coverage report
uses: "actions/upload-artifact@v4"
with:
path: coverage.xml
- name: Build executables
run: make build