Updating Go version #1
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-ignore: | |
- 'gh-pages' | |
pull_request: | |
branches-ignore: | |
- 'gh-pages' | |
jobs: | |
# Label of the container job | |
sqlite: | |
strategy: | |
matrix: | |
go: ['1.17', '1.15'] | |
platform: [ubuntu-latest, macos-latest] # can not run in windows | |
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/[email protected] | |
- 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: Tests | |
run: GORM_DIALECT=sqlite ./test_all.sh | |
mysql: | |
strategy: | |
matrix: | |
dbversion: ['mysql:latest', 'mysql:5.7', 'mariadb:latest'] | |
go: ['1.17', '1.15', '1.13'] | |
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" | |
slow_query_log: 0 | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin 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@v2 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- 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: Tests | |
run: GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(localhost:3306)/gorm?charset=utf8&parseTime=True" ./test_all.sh | |
postgres: | |
strategy: | |
matrix: | |
dbversion: ['postgres:latest', 'postgres:11', 'postgres:10'] | |
go: ['1.17', '1.15', '1.13'] | |
platform: [ubuntu-latest] # can not run in macOS and windows | |
runs-on: ${{ matrix.platform }} | |
services: | |
postgres: | |
image: ${{ matrix.dbversion }} | |
env: | |
POSTGRES_PASSWORD: gorm | |
POSTGRES_USER: gorm | |
POSTGRES_DB: gorm | |
TZ: Asia/Jakarta | |
ports: | |
- 5432:5432 | |
volumes: | |
- /var/run/postgresql:/var/run/postgresql:z | |
# 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 }} | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- 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: Tests | |
run: GORM_DIALECT=postgres GORM_DSN="user=gorm password=gorm dbname=gorm host=localhost port=5432 sslmode=disable TimeZone=Asia/Jakarta" ./test_all.sh | |
### Uncomment this to test Microsoft SQL Server | |
# sqlserver: | |
# strategy: | |
# matrix: | |
# go: ['1.17', '1.15', '1.13'] | |
# platform: [ubuntu-latest] # can not run test in macOS and windows | |
# runs-on: ${{ matrix.platform }} | |
# services: | |
# mssql: | |
# image: mcmoe/mssqldocker:latest | |
# env: | |
# ACCEPT_EULA: Y | |
# SA_PASSWORD: LoremIpsum86 | |
# MSSQL_DB: gorm | |
# MSSQL_USER: gorm | |
# MSSQL_PASSWORD: LoremIpsum86 | |
# ports: | |
# - 1433:1433 | |
# 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 | |
# 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/[email protected] | |
# - 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: Tests | |
# run: GORM_DIALECT=sqlserver GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:1433?database=gorm" ./test_all.sh |