2020-06-22 17:32:12 +03:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# Label of the container job
|
2020-06-22 17:51:54 +03:00
|
|
|
sqlite:
|
2020-06-22 17:32:12 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-06-22 17:51:54 +03:00
|
|
|
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']
|
2020-06-22 17:32:12 +03:00
|
|
|
|
|
|
|
services:
|
2020-06-22 17:51:54 +03:00
|
|
|
mysql:
|
|
|
|
image: ${{ matrix.dbversion }}
|
2020-06-22 17:32:12 +03:00
|
|
|
env:
|
2020-06-22 17:51:54 +03:00
|
|
|
MYSQL_DATABASE: gorm
|
|
|
|
MYSQL_USER: gorm
|
|
|
|
MYSQL_PASSWORD: gorm
|
|
|
|
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
2020-06-22 17:32:12 +03:00
|
|
|
ports:
|
2020-06-22 17:51:54 +03:00
|
|
|
- 9910:3306
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
- 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:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10']
|
|
|
|
go: ['1.14', '1.13']
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: ${{ matrix.dbversion }}
|
2020-06-22 17:32:12 +03:00
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: gorm
|
|
|
|
POSTGRES_USER: gorm
|
|
|
|
POSTGRES_DB: gorm
|
|
|
|
TZ: Asia/Shanghai
|
|
|
|
ports:
|
2020-06-22 17:51:54 +03:00
|
|
|
- 9920:5432
|
2020-06-22 17:32:12 +03:00
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
- name: show ports
|
|
|
|
run: netstat -lntp
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
- 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
|
|
|
|
|
|
|
|
|
|
|
|
sqlserver:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go: ['1.14', '1.13']
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
services:
|
2020-06-22 17:32:12 +03:00
|
|
|
mssql:
|
|
|
|
image: mcmoe/mssqldocker:latest
|
|
|
|
env:
|
|
|
|
ACCEPT_EULA: Y
|
|
|
|
SA_PASSWORD: LoremIpsum86
|
|
|
|
MSSQL_DB: gorm
|
|
|
|
MSSQL_USER: gorm
|
|
|
|
MSSQL_PASSWORD: LoremIpsum86
|
|
|
|
ports:
|
|
|
|
- 9930:1433
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
- name: run sqlserver
|
|
|
|
run: GORM_DIALECT=sqlserver GORM_VERBOSE=true GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
|