-
Notifications
You must be signed in to change notification settings - Fork 372
71 lines (68 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
65
66
67
68
69
70
71
name: Test
on:
pull_request:
push:
branches:
- master
- saml
- zerosessionidfix
tags: ['*']
jobs:
test:
strategy:
matrix:
go-version: [1.20.x]
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
with:
skip-unshallow: "true"
- name: Check gofmt
run: |
set -x
if [ ! -z $(gofmt -l .) ]
then
echo 'Make sure to run "gofmt -s -w ." before commit!' && exit 1
fi
- name: Check go vet
run: |
set -x
go vet ./...
- name: Run static check
run: |
set -x
go install honnef.co/go/tools/cmd/staticcheck@latest
make static
- name: Check gosec
run: |
set -x
go install github.com/securego/gosec/v2/cmd/gosec@latest
make sec
- name: Init Database
run: psql -f hack/init_postgres.sql postgresql://postgres:root@localhost:5432/postgres
- name: Run migrations
run: make migrate_dev
- name: Lint and test
run: make test
- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out