-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (54 loc) · 1.46 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
name: Test
on:
push:
branches:
- "*"
- "*/*"
pull_request:
branches:
- "*"
- "*/*"
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
go-version: ["1.20.x"]
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Verify dependencies
run: go mod verify
- name: Generate Self-Signed TLS Certificate
run: |
mkdir -p keys
openssl req -x509 -newkey rsa:4096 -keyout keys/private.key -out keys/publickey.crt -days 365 -nodes -subj "/CN=localhost"
working-directory: ${{ github.workspace }}
- name: Create .env file
run: echo "${{ secrets.ENV }}" > .env
- name: Download all dependencies
run: |
go mod download
go get -d -v ./...
go install -v ./...
- name: Run migration
run: |
go run database/migration/main.go
sleep 3s
- name: Run Test
run: go test -race ./...