mirror of
https://github.com/roninli/playground.git
synced 2024-10-18 08:09:38 +00:00
Update test script, close #494
This commit is contained in:
parent
40df23c279
commit
70ec454f64
10
README.md
10
README.md
@ -10,18 +10,14 @@ GORM Playground can be used to play GORM and reports issues, if you encounter a
|
||||
|
||||
##### 2. [Clone the forked repo to your local](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
|
||||
|
||||
##### 3. Setup test database
|
||||
##### 3. Install docker-compose
|
||||
|
||||
```bash
|
||||
# install docker-compose https://docs.docker.com/compose/install/
|
||||
|
||||
# setup test databases
|
||||
docker-compose up
|
||||
```
|
||||
https://docs.docker.com/compose/install/
|
||||
|
||||
##### 4. Run tests with lastest GORM and all drivers
|
||||
|
||||
```bash
|
||||
# run tests (retry if failed due to preparing the testing database)
|
||||
./test.sh
|
||||
|
||||
# Run tests with cached GORM and latest drivers
|
||||
|
@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: 'mysql:latest'
|
||||
image: 'mysql/mysql-server:latest'
|
||||
ports:
|
||||
- 9910:3306
|
||||
environment:
|
||||
@ -20,7 +20,7 @@ services:
|
||||
- POSTGRES_USER=gorm
|
||||
- POSTGRES_PASSWORD=gorm
|
||||
mssql:
|
||||
image: 'mcmoe/mssqldocker:latest'
|
||||
image: '${MSSQL_IMAGE:-mcmoe/mssqldocker}:latest'
|
||||
ports:
|
||||
- 9930:1433
|
||||
environment:
|
||||
@ -29,4 +29,3 @@ services:
|
||||
- MSSQL_DB=gorm
|
||||
- MSSQL_USER=gorm
|
||||
- MSSQL_PASSWORD=LoremIpsum86
|
||||
|
||||
|
13
go.mod
13
go.mod
@ -3,14 +3,13 @@ module gorm.io/playground
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/denisenkom/go-mssqldb v0.12.2 // indirect
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
|
||||
github.com/jackc/pgx/v4 v4.16.1 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 // indirect
|
||||
gorm.io/driver/mysql v1.3.3
|
||||
gorm.io/driver/postgres v1.3.5
|
||||
gorm.io/driver/sqlite v1.3.2
|
||||
gorm.io/driver/sqlserver v1.3.2
|
||||
gorm.io/gorm v1.23.4
|
||||
gorm.io/driver/mysql v1.4.1
|
||||
gorm.io/driver/postgres v1.4.4
|
||||
gorm.io/driver/sqlite v1.4.2
|
||||
gorm.io/driver/sqlserver v1.4.1
|
||||
gorm.io/gorm v1.24.0
|
||||
)
|
||||
|
||||
replace gorm.io/gorm => ./gorm
|
||||
|
17
test.sh
17
test.sh
@ -9,7 +9,22 @@ fi
|
||||
|
||||
[ -d gorm ] || (echo "git clone --depth 1 -b $(cat main_test.go | grep GORM_BRANCH | awk '{print $3}') $(cat main_test.go | grep GORM_REPO | awk '{print $3}')"; git clone --depth 1 -b $(cat main_test.go | grep GORM_BRANCH | awk '{print $3}') $(cat main_test.go | grep GORM_REPO | awk '{print $3}'))
|
||||
|
||||
go get -u ./...
|
||||
go get -u -t ./...
|
||||
|
||||
# SqlServer for Mac M1
|
||||
if [[ -z $GITHUB_ACTION ]]; then
|
||||
if [[ $(uname -a) == *" arm64" ]]; then
|
||||
MSSQL_IMAGE=mcr.microsoft.com/azure-sql-edge docker-compose up --detach --quiet-pull || true
|
||||
echo "starting"
|
||||
go install github.com/microsoft/go-sqlcmd/cmd/sqlcmd@latest || true
|
||||
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF DB_ID('gorm') IS NULL CREATE DATABASE gorm" > /dev/null || true
|
||||
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF SUSER_ID (N'gorm') IS NULL CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';" > /dev/null || true
|
||||
SQLCMDPASSWORD=LoremIpsum86 sqlcmd -U sa -S localhost:9930 -Q "IF USER_ID (N'gorm') IS NULL CREATE USER gorm FROM LOGIN gorm; ALTER SERVER ROLE sysadmin ADD MEMBER [gorm];" > /dev/null || true
|
||||
else
|
||||
docker-compose up --detach --quiet-pull
|
||||
echo "starting..."
|
||||
fi
|
||||
fi
|
||||
|
||||
for dialect in "${dialects[@]}" ; do
|
||||
if [ "$GORM_DIALECT" = "" ] || [ "$GORM_DIALECT" = "${dialect}" ]
|
||||
|
Loading…
Reference in New Issue
Block a user