forked from alice-lg/alice-lg
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 1.64 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
72
73
74
75
76
77
78
79
80
name: Test
on: [ push, workflow_dispatch ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: alice
POSTGRES_PASSWORD: alice
POSTGRES_DB: alice
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
# Install development dependencies
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.18.x'
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
- name: Add UI build stub
working-directory: ./ui
run: |
mkdir -p ./build
touch ./build/UI_BUILD_STUB
# Formatting
- name: Check formatting
run: |
test -z $(gofmt -l ./pkg)
test -z $(gofmt -l ./cmd)
# Vet
- name: Vet
run: |
go vet ./pkg/...
go vet ./cmd/...
# Lint
- name: Lint
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./pkg/...
golint -set_exit_status ./cmd/...
# Test environment
- name: Setup Test Database
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: alice
PGPASSWORD: alice
working-directory: ./db
run: |
./init.sh -c -t
# Run Tests
- name: UI Tests
run: make ui_test
- name: Backend Tests
run: make backend_test