Update circle-ci config

This commit is contained in:
go-jet 2021-01-24 16:47:06 +01:00
parent 667d534a65
commit 92818acd50
4 changed files with 12 additions and 40 deletions

View file

@ -6,7 +6,7 @@ jobs:
build-postgres-and-mysql:
docker:
# specify the version
- image: circleci/golang:1.11
- image: circleci/golang:1.13
- image: circleci/postgres:10.8-alpine
environment: # environment variables for primary container
@ -14,7 +14,7 @@ jobs:
POSTGRES_PASSWORD: jet
POSTGRES_DB: jetdb
- image: circleci/mysql:8.0
- image: circleci/mysql:8.0.16
command: [--default-authentication-plugin=mysql_native_password]
environment:
MYSQL_ROOT_PASSWORD: jet
@ -41,17 +41,9 @@ jobs:
- run:
name: Install dependencies
command: |
go get github.com/google/uuid
go get github.com/lib/pq
go get github.com/go-sql-driver/mysql
go get github.com/pkg/profile
go get github.com/stretchr/testify/assert
go get github.com/google/go-cmp/cmp
go get github.com/davecgh/go-spew/spew
cd /go/src/github.com/go-jet/jet
go get github.com/jstemmer/go-junit-report
go install github.com/go-jet/jet/cmd/jet
go build -o /home/circleci/.local/bin/jet ./cmd/jet/
- run:
name: Waiting for Postgres to be ready
@ -95,7 +87,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS
- run: go test -v ./... -coverpkg=github.com/go-jet/jet/postgres/...,github.com/go-jet/jet/mysql/...,github.com/go-jet/jet/qrm/...,github.com/go-jet/jet/generator/...,github.com/go-jet/jet/internal/... -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml
- run: MY_SQL_SOURCE=MySQL go test -v ./... -coverpkg=github.com/go-jet/jet/postgres/...,github.com/go-jet/jet/mysql/...,github.com/go-jet/jet/qrm/...,github.com/go-jet/jet/generator/...,github.com/go-jet/jet/internal/... -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml
- run:
name: Upload code coverage
@ -110,7 +102,7 @@ jobs:
build-mariadb:
docker:
# specify the version
- image: circleci/golang:1.11
- image: circleci/golang:1.13
- image: circleci/mariadb:10.3
command: [--default-authentication-plugin=mysql_native_password]
@ -138,17 +130,9 @@ jobs:
- run:
name: Install dependencies
command: |
go get github.com/google/uuid
go get github.com/lib/pq
go get github.com/go-sql-driver/mysql
go get github.com/pkg/profile
go get github.com/stretchr/testify/assert
go get github.com/google/go-cmp/cmp
go get github.com/davecgh/go-spew/spew
cd /go/src/github.com/go-jet/jet
go get github.com/jstemmer/go-junit-report
go install github.com/go-jet/jet/cmd/jet
go build -o /home/circleci/.local/bin/jet ./cmd/jet/
- run:
name: Install MySQL CLI;
@ -172,7 +156,7 @@ jobs:
- run:
name: Run MariaDB tests
command: |
go test -v ./tests/mysql/ -source=MariaDB
MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/
workflows:
version: 2

View file

@ -35,12 +35,7 @@ func TestGenerator(t *testing.T) {
}
func TestCmdGenerator(t *testing.T) {
goInstallJet := exec.Command("sh", "-c", "cd $GOPATH/src/ && GO111MODULE=off go get github.com/go-jet/jet/cmd/jet")
goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run()
require.NoError(t, err)
err = os.RemoveAll(genTestDir3)
err := os.RemoveAll(genTestDir3)
require.NoError(t, err)
cmd := exec.Command("jet", "-source=MySQL", "-dbname=dvds", "-host=localhost", "-port=3306",

View file

@ -3,7 +3,6 @@ package mysql
import (
"context"
"database/sql"
"flag"
jetmysql "github.com/go-jet/jet/v2/mysql"
"github.com/go-jet/jet/v2/postgres"
"github.com/go-jet/jet/v2/tests/dbconfig"
@ -25,8 +24,7 @@ var source string
const MariaDB = "MariaDB"
func init() {
flag.StringVar(&source, "source", "", "MySQL or MariaDB")
flag.Parse()
source = os.Getenv("MY_SQL_SOURCE")
}
func sourceIsMariaDB() bool {

View file

@ -46,12 +46,7 @@ func TestGeneratedModel(t *testing.T) {
const genTestDir2 = "./.gentestdata2"
func TestCmdGenerator(t *testing.T) {
goInstallJet := exec.Command("sh", "-c", "cd $GOPATH/src/ && GO111MODULE=off go get github.com/go-jet/jet/cmd/jet")
goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run()
require.NoError(t, err)
err = os.RemoveAll(genTestDir2)
err := os.RemoveAll(genTestDir2)
require.NoError(t, err)
cmd := exec.Command("jet", "-source=PostgreSQL", "-dbname=jetdb", "-host=localhost", "-port=5432",