-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (50 loc) · 1.56 KB
/
test.yaml
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
name: test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Setup minio
run: |
docker run -d -p 9000:9000 --name minio \
-e "MINIO_ACCESS_KEY=minioadmin" \
-e "MINIO_SECRET_KEY=minioadmin" \
minio/minio server /data
- name: Setup Nsq
run: |
docker run --name nsqlookupd -p 4160:4160 -p 4161:4161 -d nsqio/nsq /nsqlookupd
docker run --name nsqd -p 4150:4150 -p 4151:4151 -d nsqio/nsq /nsqd
- name: Run coverage
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root
DB_DATABASE: test
S3_ENDPOINT: localhost:9000
REDIS_HOST: localhost
REDIS_PORT: 6379
NSQ_ADDR: localhost:4150
NSQ_LOOKUPD_ADDR: localhost:4161
run: |
mkdir frontend/build && touch frontend/build/dummy
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)