-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (84 loc) · 2.42 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
85
86
87
name: lint & test
on:
push:
tags:
- v*
branches:
- v1.1
pull_request:
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
env:
GOPRIVATE: github.com/naturalselectionlabs/kurora
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://sljeff:${TOKEN}@github.com".insteadOf "https://github.com"
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
tests:
name: "UnitTest"
runs-on: self-hosted
services:
pgsql:
image: "postgres:13.4"
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: postgres
POSTGRES_DB: pregod11
ports:
- "5432:5432"
rabbitmq:
image: rabbitmq:3-management
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- "5672:5672"
- "15672:15672"
redis:
image: redis:alpine
ports:
- "6379:6379"
steps:
- name: Check out code into Go module directory
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Go mod package cache
uses: actions/cache@v3
with:
path: $GOPATH/pkg/mod
key: ${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://sljeff:${TOKEN}@github.com".insteadOf "https://github.com"
- run: |
# When running unit tests, `deploy/config` is read from the relative path of the test file. So you must use the global conf
mkdir -p ~/.pregod
cp deploy/config/* ~/.pregod
- uses: sljeff/secrets2env@main
with:
secrets-json: ${{ toJson(secrets) }}
- name: Run tests
env:
CONFIG_ENV_POSTGRES_HOST: localhost
CONFIG_ENV_RABBITMQ_HOST: localhost
run: |
go install github.com/wadey/gocovmerge@latest
make coverage_fail