forked from mirror/gorm
add macos and windows for sqlite unit test and use cache for go mod package download (#3079)
Co-authored-by: EricZhou <zhouqing1@360.cn>
This commit is contained in:
parent
b733d16f56
commit
dd7caa9db0
|
@ -11,10 +11,11 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
# Label of the container job
|
# Label of the container job
|
||||||
sqlite:
|
sqlite:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: ['1.14', '1.13']
|
go: ['1.14', '1.13']
|
||||||
|
platform: [ubuntu-latest, macos-latest] # can not run in windows OS
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
|
@ -25,16 +26,47 @@ jobs:
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: go mod pakcage cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
||||||
|
|
||||||
- name: run sqlite
|
- name: run sqlite
|
||||||
run: GORM_DIALECT=sqlite GORM_VERBOSE=true ./tests/tests_all.sh
|
run: GORM_DIALECT=sqlite GORM_VERBOSE=true ./tests/tests_all.sh
|
||||||
|
|
||||||
|
sqlite_windows:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: ['1.14', '1.13']
|
||||||
|
platform: [windows-latest]
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go 1.x
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: go mod pakcage cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
||||||
|
|
||||||
|
- name: run sqlite
|
||||||
|
run: cd tests && set GORM_DIALECT=sqlite && go test $race -count=1 -v ./... #run the line in widnows's CMD, default GORM_DIALECT is sqlite
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dbversion: ['mysql:latest', 'mysql:5.7', 'mysql:5.6', 'mariadb:latest']
|
dbversion: ['mysql:latest', 'mysql:5.7', 'mysql:5.6', 'mariadb:latest']
|
||||||
go: ['1.14', '1.13']
|
go: ['1.14', '1.13']
|
||||||
|
platform: [ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
|
@ -56,18 +88,23 @@ jobs:
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: show ports
|
|
||||||
run: netstat -lntp
|
- name: go mod pakcage cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
||||||
|
|
||||||
- name: run mysql
|
- name: run mysql
|
||||||
run: GORM_DIALECT=mysql GORM_VERBOSE=true GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
|
run: GORM_DIALECT=mysql GORM_VERBOSE=true GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10']
|
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10']
|
||||||
go: ['1.14', '1.13']
|
go: ['1.14', '1.13']
|
||||||
|
platform: [ubuntu-latest] # can not run in macOS and widnowsOS
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -95,18 +132,21 @@ jobs:
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: show ports
|
- name: go mod pakcage cache
|
||||||
run: netstat -lntp
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
||||||
|
|
||||||
- name: run postgres
|
- name: run postgres
|
||||||
run: GORM_DIALECT=postgres GORM_VERBOSE=true GORM_DSN="user=gorm password=gorm DB.name=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
|
run: GORM_DIALECT=postgres GORM_VERBOSE=true GORM_DSN="user=gorm password=gorm DB.name=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
|
||||||
|
|
||||||
|
|
||||||
sqlserver:
|
sqlserver:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: ['1.14', '1.13']
|
go: ['1.14', '1.13']
|
||||||
|
platform: [ubuntu-latest] # can not run test in macOS and windows
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mssql:
|
mssql:
|
||||||
|
@ -129,8 +169,11 @@ jobs:
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: show ports
|
- name: go mod pakcage cache
|
||||||
run: netstat -lntp
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
||||||
|
|
||||||
- name: run sqlserver
|
- name: run sqlserver
|
||||||
run: GORM_DIALECT=sqlserver GORM_VERBOSE=true GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
|
run: GORM_DIALECT=sqlserver GORM_VERBOSE=true GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
|
||||||
|
|
Loading…
Reference in New Issue