-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (77 loc) · 2.08 KB
/
lint-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
81
82
83
84
name: Lint & Test
on:
push:
branches: '**'
pull_request:
branches: '**'
jobs:
Lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
args: -e SA1029
Test:
name: Test
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_USER: twt
POSTGRES_PASSWORD: twt
POSTGRES_DB: twt
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
# Docker Hub image
image: redis
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set Up Submodule
run: |
git submodule init
git submodule update
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Migrate
run: go run main.go migrate_up
env:
DB_URI: postgres://twt:twt@localhost:5432/twt?sslmode=disable
SECRET_KEY: mysecret
MAX_FILE_SIZE: 30
- name: test
run: go test -v -p 1 -coverprofile=coverage.txt -covermode=atomic ./...
env:
DB_URI: postgres://twt:twt@localhost:5432/twt?sslmode=disable
SECRET_KEY: mysecret
MAX_FILE_SIZE: 30
REDIS_HOST: localhost:6379
REDIS_DB: 0
- name: Upload to CodeCov
run: bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}