-
-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (112 loc) · 3.89 KB
/
main.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Build+Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21.6' ]
services:
postgres:
image: postgres:9.6
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ssetest
mysql:
image: mysql:8.3
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: omgroot
MYSQL_DATABASE: ssetest
MYSQL_USER: ssetestusr
MYSQL_PASSWORD: ssetestusrpass
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Apt packages
run: sudo apt install sqlite3 postgresql-client gcc-mingw-w64-x86-64 mysql-client
- name: install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest
- uses: actions/checkout@v4
- name: Install dependencies
run: go get .
- name: Test - mysql
env:
schemaexplorer_driver: mysql
schemaexplorer_live: false
schemaexplorer_mysql_user: ssetestusr
schemaexplorer_mysql_password: ssetestusr
schemaexplorer_mysql_host: 127.0.0.1
#schemaexplorer_mysql_connection_string: "mysql://ssetestusr:ssetestusrpass@tcp(localhost:3306)/ssetest"
run: |
pushd .
cd mysql
# Use ip address to stop mysql trying to use sockets, which it does for "localhost"
mysql -h 127.0.0.1 -u root -pomgroot ssetest < test-db.sql
popd
go clean -testcache
go test -v sse_test.go \
2>&1 | go-junit-report -iocopy -set-exit-code -out results-mysql-${{ matrix.go-version }}.xml
- name: Test - sqlite flags
run: |
pushd .
cd sqlite
./setup.sh
file="`pwd`/db/test.db" # relative path hack with pwd, otherwise not resolved.
popd
go clean -testcache
go test -json sse_test.go \
--driver=sqlite \
--display-name=testing-flags \
--live=true \
--listen-on-port=9999 \
--sqlite-file="$file" \
2>&1 | go-junit-report -parser gojson -iocopy -out results-sqlite-flags-${{ matrix.go-version }}.xml
- name: Test - sqlite env
env:
schemaexplorer_driver: sqlite
schemaexplorer_live: false
run: |
pushd .
cd sqlite
./setup.sh
file="`pwd`/db/test.db" # relative path hack with pwd, otherwise not resolved.
export schemaexplorer_sqlite_file="$file"
popd
go clean -testcache
go test -json sse_test.go \
2>&1 | go-junit-report -parser gojson -iocopy -out results-sqlite-env-${{ matrix.go-version }}.xml
- name: Test - pg
env:
schemaexplorer_driver: pg
schemaexplorer_pg_connection_string: "postgres://ssetestusr:ssetestusr@localhost/ssetest?sslmode=disable"
run: |
pushd .
cd pg
./setup-ssetest.sh
popd
go clean -testcache
go test -json sse_test.go \
2>&1 | go-junit-report -parser gojson -iocopy -out results-pg-${{ matrix.go-version }}.xml
- name: Upload Go test results
uses: actions/upload-artifact@v3
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Tests # Name of the check run which will be created
path: results-*.xml # Path to test results
reporter: jest-junit # Format of test results