Refactor github actions

This commit is contained in:
Jinzhu 2020-06-22 22:51:54 +08:00
parent 60d1e68567
commit 71ae2ddbee
1 changed files with 75 additions and 98 deletions

View File

@ -8,16 +8,68 @@ on:
jobs:
# Label of the container job
tests:
sqlite:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.14', '1.13']
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: run sqlite
run: GORM_DIALECT=sqlite GORM_VERBOSE=true ./tests/tests_all.sh
mysql:
runs-on: ubuntu-latest
strategy:
matrix:
dbversion: ['mysql:latest', 'mysql:5.7', 'mysql:5.6', 'mariadb:latest']
go: ['1.14', '1.13']
services:
# start postgres
mysql:
image: ${{ matrix.dbversion }}
env:
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 9910:3306
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: show ports
run: netstat -lntp
- 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
postgres:
image: postgres:latest
runs-on: ubuntu-latest
strategy:
matrix:
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10']
go: ['1.14', '1.13']
services:
postgres:
image: ${{ matrix.dbversion }}
env:
POSTGRES_PASSWORD: gorm
POSTGRES_USER: gorm
@ -32,80 +84,29 @@ jobs:
--health-timeout 5s
--health-retries 5
postgres11:
image: postgres:11
env:
POSTGRES_PASSWORD: gorm
POSTGRES_USER: gorm
POSTGRES_DB: gorm
TZ: Asia/Shanghai
ports:
- 9921:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
postgres10:
image: postgres:10
env:
POSTGRES_PASSWORD: gorm
POSTGRES_USER: gorm
POSTGRES_DB: gorm
TZ: Asia/Shanghai
ports:
- 9922:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# start mysql
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 9910:3306
- name: show ports
run: netstat -lntp
mysql57:
image: mysql:5.7
env:
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 9911:3306
- 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
mysql56:
image: mysql:5.6
env:
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 9912:3306
mariadb:
image: mariadb:latest
env:
MYSQL_DATABASE: gorm
MYSQL_USER: gorm
MYSQL_PASSWORD: gorm
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 9913:3306
sqlserver:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.14', '1.13']
# start mssql
services:
mssql:
image: mcmoe/mssqldocker:latest
env:
@ -129,29 +130,5 @@ jobs:
- name: show ports
run: netstat -lntp
- name: run sqlite
run: GORM_DIALECT=sqlite GORM_VERBOSE=true ./tests/tests_all.sh
- 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
- name: run mysql57
run: GORM_DIALECT=mysql GORM_VERBOSE=true GORM_DSN="gorm:gorm@tcp(localhost:9911)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
- name: run mysql56
run: GORM_DIALECT=mysql GORM_VERBOSE=true GORM_DSN="gorm:gorm@tcp(localhost:9912)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
- name: run mariadb
run: GORM_DIALECT=mysql GORM_VERBOSE=true GORM_DSN="gorm:gorm@tcp(localhost:9913)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
- 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
- name: run postgres11
run: GORM_DIALECT=postgres GORM_VERBOSE=true GORM_DSN="user=gorm password=gorm DB.name=gorm port=9921 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
- name: run postgres10
run: GORM_DIALECT=postgres GORM_VERBOSE=true GORM_DSN="user=gorm password=gorm DB.name=gorm port=9922 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
- name: run mssql
run: GORM_DIALECT=mssql GORM_VERBOSE=true GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
- name: run sqlserver
run: GORM_DIALECT=sqlserver GORM_VERBOSE=true GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh