replace condition which with QualifyRef #233
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
postgres: | |
strategy: | |
matrix: | |
dbversion: | |
[ | |
"postgres:latest", | |
"postgres:13", | |
"postgres:12", | |
"postgres:11", | |
"postgres:10", | |
] | |
platform: [ubuntu-latest] # can not run in macOS and Windows | |
runs-on: ${{ matrix.platform }} | |
services: | |
postgres: | |
image: ${{ matrix.dbversion }} | |
env: | |
POSTGRES_DB: sharding-test | |
POSTGRES_USER: gorm | |
POSTGRES_PASSWORD: gorm | |
TZ: Asia/Shanghai | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
DIALECTOR: postgres | |
DB_URL: postgres://gorm:gorm@localhost:5432/sharding-test | |
DB_NOID_URL: postgres://gorm:gorm@localhost:5432/sharding-noid-test | |
DB_READ_URL: postgres://gorm:gorm@localhost:5432/sharding-read-test | |
DB_WRITE_URL: postgres://gorm:gorm@localhost:5432/sharding-write-test | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.20" | |
id: go | |
- name: Create No ID Database | |
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-noid-test";' | |
- name: Create Read Database | |
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-read-test";' | |
- name: Create Write Databases | |
run: PGPASSWORD=gorm psql -h localhost -U gorm -d sharding-test -c 'CREATE DATABASE "sharding-write-test";' | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Test | |
run: go test | |
mysql: | |
name: MySQL | |
strategy: | |
matrix: | |
dbversion: ["mysql:latest", "mysql:5.7"] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
services: | |
mysql: | |
image: ${{ matrix.dbversion }} | |
env: | |
MYSQL_DATABASE: sharding-test | |
MYSQL_USER: gorm | |
MYSQL_PASSWORD: gorm | |
MYSQL_ROOT_PASSWORD: gorm | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ugorm -pgorm" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
env: | |
DIALECTOR: mysql | |
DB_URL: gorm:gorm@tcp(127.0.0.1:3306)/sharding-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_NOID_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-noid-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_READ_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-read-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_WRITE_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-write-test?charset=utf8mb4&parseTime=True&loc=Local | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.20" | |
id: go | |
- name: Create No ID Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-noid-test | |
- name: Create Read Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-read-test | |
- name: Create Write Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-write-test | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Test | |
run: go test | |
mariadb: | |
name: MariaDB | |
strategy: | |
matrix: | |
dbversion: ["mariadb:10.11"] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
services: | |
mariadb: | |
image: ${{ matrix.dbversion }} | |
env: | |
MYSQL_DATABASE: sharding-test | |
MYSQL_USER: gorm | |
MYSQL_PASSWORD: gorm | |
MYSQL_ROOT_PASSWORD: gorm | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -ugorm -pgorm" | |
--health-interval 10s | |
--health-start-period 10s | |
--health-timeout 5s | |
--health-retries 10 | |
env: | |
DIALECTOR: mariadb | |
DB_URL: gorm:gorm@tcp(127.0.0.1:3306)/sharding-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_NOID_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-noid-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_READ_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-read-test?charset=utf8mb4&parseTime=True&loc=Local | |
DB_WRITE_URL: root:gorm@tcp(127.0.0.1:3306)/sharding-write-test?charset=utf8mb4&parseTime=True&loc=Local | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.20" | |
id: go | |
- name: Create No ID Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-noid-test | |
- name: Create Read Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-read-test | |
- name: Create Write Database | |
run: mysqladmin -h 127.0.0.1 -uroot -pgorm create sharding-write-test | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Test | |
run: go test |