2020-06-22 18:14:17 +03:00
|
|
|
name: tests
|
2020-06-22 17:32:12 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-06-22 18:14:17 +03:00
|
|
|
branches-ignore:
|
|
|
|
- 'gh-pages'
|
2020-06-22 17:32:12 +03:00
|
|
|
pull_request:
|
2020-06-22 18:14:17 +03:00
|
|
|
branches-ignore:
|
|
|
|
- 'gh-pages'
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2022-04-10 04:38:43 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-06-22 17:32:12 +03:00
|
|
|
jobs:
|
|
|
|
# Label of the container job
|
2020-06-22 17:51:54 +03:00
|
|
|
sqlite:
|
2020-06-22 17:32:12 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2021-03-24 09:22:36 +03:00
|
|
|
platform: [ubuntu-latest] # can not run in windows OS
|
2020-06-23 11:00:04 +03:00
|
|
|
runs-on: ${{ matrix.platform }}
|
2020-06-22 17:51:54 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
2023-03-23 06:18:02 +03:00
|
|
|
uses: actions/setup-go@v4
|
2020-06-22 17:51:54 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2022-03-12 17:28:18 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-06-22 17:51:54 +03:00
|
|
|
|
2021-01-27 06:18:39 +03:00
|
|
|
- name: go mod package cache
|
2022-03-28 14:55:05 +03:00
|
|
|
uses: actions/cache@v3
|
2020-06-23 11:00:04 +03:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
|
|
|
|
2020-06-24 09:48:44 +03:00
|
|
|
- name: Tests
|
2022-01-30 17:32:34 +03:00
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=sqlite ./tests/tests_all.sh
|
2020-06-22 17:51:54 +03:00
|
|
|
|
|
|
|
mysql:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-06-11 02:42:18 +03:00
|
|
|
dbversion: ['mysql:latest', 'mysql:5.7']
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2020-06-23 11:00:04 +03:00
|
|
|
platform: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
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-07-04 02:57:33 +03:00
|
|
|
options: >-
|
|
|
|
--health-cmd "mysqladmin ping -ugorm -pgorm"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-start-period 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 10
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
2023-03-23 06:18:02 +03:00
|
|
|
uses: actions/setup-go@v4
|
2020-06-22 17:51:54 +03:00
|
|
|
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
|
2022-03-12 17:28:18 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-06-22 17:51:54 +03:00
|
|
|
|
2021-01-27 06:18:39 +03:00
|
|
|
- name: go mod package cache
|
2022-03-28 14:55:05 +03:00
|
|
|
uses: actions/cache@v3
|
2020-06-23 11:00:04 +03:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
2020-06-22 17:51:54 +03:00
|
|
|
|
2020-06-24 09:48:44 +03:00
|
|
|
- name: Tests
|
2022-01-30 17:32:34 +03:00
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
|
2020-06-22 17:51:54 +03:00
|
|
|
|
2023-06-11 02:42:18 +03:00
|
|
|
mariadb:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
dbversion: [ 'mariadb:latest' ]
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2023-06-11 02:42:18 +03:00
|
|
|
platform: [ ubuntu-latest ]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
|
|
|
services:
|
|
|
|
mysql:
|
|
|
|
image: ${{ matrix.dbversion }}
|
|
|
|
env:
|
|
|
|
MYSQL_DATABASE: gorm
|
|
|
|
MYSQL_USER: gorm
|
|
|
|
MYSQL_PASSWORD: gorm
|
|
|
|
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
|
|
|
ports:
|
|
|
|
- 9910:3306
|
|
|
|
options: >-
|
|
|
|
--health-cmd "mariadb-admin ping -ugorm -pgorm"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-start-period 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 10
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: go mod package cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
|
|
|
|
|
|
|
- name: Tests
|
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
|
|
|
|
|
2020-06-22 17:51:54 +03:00
|
|
|
postgres:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-10-08 05:51:53 +03:00
|
|
|
dbversion: ['postgres:latest', 'postgres:13', 'postgres:12', 'postgres:11', 'postgres:10']
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2021-04-19 16:03:39 +03:00
|
|
|
platform: [ubuntu-latest] # can not run in macOS and Windows
|
2020-06-23 11:00:04 +03:00
|
|
|
runs-on: ${{ matrix.platform }}
|
2020-06-22 17:51:54 +03:00
|
|
|
|
|
|
|
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
|
2023-03-23 06:18:02 +03:00
|
|
|
uses: actions/setup-go@v4
|
2020-06-22 17:51:54 +03:00
|
|
|
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
|
2022-03-12 17:28:18 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2021-01-27 06:18:39 +03:00
|
|
|
- name: go mod package cache
|
2022-03-28 14:55:05 +03:00
|
|
|
uses: actions/cache@v3
|
2020-06-23 11:00:04 +03:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-24 09:48:44 +03:00
|
|
|
- name: Tests
|
2022-01-30 17:32:34 +03:00
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=postgres GORM_DSN="user=gorm password=gorm dbname=gorm host=localhost port=9920 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
|
2020-06-22 17:51:54 +03:00
|
|
|
|
|
|
|
sqlserver:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2020-06-23 11:00:04 +03:00
|
|
|
platform: [ubuntu-latest] # can not run test in macOS and windows
|
|
|
|
runs-on: ${{ matrix.platform }}
|
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
|
2020-07-04 02:57:33 +03:00
|
|
|
options: >-
|
|
|
|
--health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P LoremIpsum86 -l 30 -Q \"SELECT 1\" || exit 1"
|
|
|
|
--health-start-period 10s
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 10
|
2020-06-22 17:32:12 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.x
|
2023-03-23 06:18:02 +03:00
|
|
|
uses: actions/setup-go@v4
|
2020-06-22 17:32:12 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2022-03-12 17:28:18 +03:00
|
|
|
uses: actions/checkout@v3
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2021-01-27 06:18:39 +03:00
|
|
|
- name: go mod package cache
|
2022-03-28 14:55:05 +03:00
|
|
|
uses: actions/cache@v3
|
2020-06-23 11:00:04 +03:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
2020-06-22 17:32:12 +03:00
|
|
|
|
2020-06-24 09:48:44 +03:00
|
|
|
- name: Tests
|
2022-01-30 17:32:34 +03:00
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=sqlserver GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh
|
2023-02-08 11:29:09 +03:00
|
|
|
|
|
|
|
tidb:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
dbversion: [ 'v6.5.0' ]
|
2023-08-24 15:19:29 +03:00
|
|
|
go: ['1.21', '1.20', '1.19']
|
2023-02-08 11:29:09 +03:00
|
|
|
platform: [ ubuntu-latest ]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Setup TiDB
|
|
|
|
uses: Icemap/tidb-action@main
|
|
|
|
with:
|
|
|
|
port: 9940
|
|
|
|
version: ${{matrix.dbversion}}
|
|
|
|
|
|
|
|
- name: Set up Go 1.x
|
2023-03-23 06:18:02 +03:00
|
|
|
uses: actions/setup-go@v4
|
2023-02-08 11:29:09 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
|
|
|
|
- name: go mod package cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
|
|
|
|
|
|
|
|
- name: Tests
|
|
|
|
run: GITHUB_ACTION=true GORM_DIALECT=tidb GORM_DSN="root:@tcp(localhost:9940)/test?charset=utf8&parseTime=True&loc=Local" ./tests/tests_all.sh
|