Skip to content

Commit

Permalink
chore(github): add unit test for 1.20 and 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1v3r committed Jan 16, 2024
1 parent 16a35f1 commit 01c8885
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ name: tests
on:
push:
branches-ignore:
- 'gh-pages'
- "gh-pages"
pull_request:
branches-ignore:
- 'gh-pages'
- "gh-pages"

jobs:
# Label of the container job
tests:
strategy:
matrix:
go: ['1.19', '1.18']
go: ["1.21", "1.20", "1.19", "1.18"]
platform: [ubuntu-latest] # can not run in windows OS
runs-on: ${{ matrix.platform }}

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
- 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('go.sum') }}
- name: go mod package cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('go.sum') }}

- name: Tests
run: go test ./...
- name: Tests
run: go test ./...

mysql:
strategy:
matrix:
dbversion: ['mysql:5.7', 'mysql:latest']
go: ['1.19', '1.18']
dbversion: ["mysql:5.7", "mysql:latest"]
go: ["1.19", "1.18"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

Expand All @@ -62,24 +62,22 @@ jobs:
--name mysql_server
steps:
- name: Change MySQL sql_mode
run: docker exec mysql_server mysql -uroot -p123456 -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"
- name: Change MySQL sql_mode
run: docker exec mysql_server mysql -uroot -p123456 -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';"

- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
- 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: 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="gen:gen@tcp(localhost:9910)/gen?charset=utf8&parseTime=True" ./tests/test.sh

- name: Tests
run: GITHUB_ACTION=true GORM_DIALECT=mysql GORM_DSN="gen:gen@tcp(localhost:9910)/gen?charset=utf8&parseTime=True" ./tests/test.sh

0 comments on commit 01c8885

Please sign in to comment.