-
Notifications
You must be signed in to change notification settings - Fork 35
62 lines (53 loc) · 1.56 KB
/
unit-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
name: UnitTest
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.18.2]
db: [MySQL8.0, MySQL5.7, MySQL5.6, Postgres9.6, Postgres14.0, SQLite3]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup ${{ matrix.db }}
uses: ./.github/actions/setup-db
with:
kind: "${{ matrix.db }}"
db: "xun"
user: "xun"
password: "123456"
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Setup Go Tools
run: |
make tools
- name: Setup ENV
run: |
echo "XUN_UNIT_NAME=$DB_NAME" >> $GITHUB_ENV
echo "XUN_UNIT_DRIVER=$DB_DRIVER" >> $GITHUB_ENV
echo "XUN_UNIT_LOG=$HOME/${{ matrix.db }}-${{ matrix.go }}.log" >> $GITHUB_ENV
echo $PATH
- name: Run Test
env:
PASSWORD: "123456"
# POSTGRES_DSN: ${{ secrets.UNIT_POSTGRES_DSN }}
run: |
make vet
make fmt-check
make misspell-check
if [ "$DB_DRIVER" = "mysql" ]; then
XUN_UNIT_SOURCE="$DB_USER:$PASSWORD@$DB_HOST" make test
elif [ "$DB_DRIVER" = "postgres" ]; then
XUN_UNIT_SOURCE="postgres://$DB_USER:$PASSWORD@$DB_HOST" make test
else
XUN_UNIT_SOURCE="$DB_HOST" make test
fi
- name: Codecov Report
uses: codecov/codecov-action@v2