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: build-postgres-and-mysql:
docker: docker:
# specify the version # specify the version
- image: circleci/golang:1.11 - image: circleci/golang:1.13
- image: circleci/postgres:10.8-alpine - image: circleci/postgres:10.8-alpine
environment: # environment variables for primary container environment: # environment variables for primary container
@ -14,7 +14,7 @@ jobs:
POSTGRES_PASSWORD: jet POSTGRES_PASSWORD: jet
POSTGRES_DB: jetdb POSTGRES_DB: jetdb
- image: circleci/mysql:8.0 - image: circleci/mysql:8.0.16
command: [--default-authentication-plugin=mysql_native_password] command: [--default-authentication-plugin=mysql_native_password]
environment: environment:
MYSQL_ROOT_PASSWORD: jet MYSQL_ROOT_PASSWORD: jet
@ -41,17 +41,9 @@ jobs:
- run: - run:
name: Install dependencies name: Install dependencies
command: | command: |
go get github.com/google/uuid cd /go/src/github.com/go-jet/jet
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
go get github.com/jstemmer/go-junit-report go get github.com/jstemmer/go-junit-report
go build -o /home/circleci/.local/bin/jet ./cmd/jet/
go install github.com/go-jet/jet/cmd/jet
- run: - run:
name: Waiting for Postgres to be ready name: Waiting for Postgres to be ready
@ -95,7 +87,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS - 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: - run:
name: Upload code coverage name: Upload code coverage
@ -110,7 +102,7 @@ jobs:
build-mariadb: build-mariadb:
docker: docker:
# specify the version # specify the version
- image: circleci/golang:1.11 - image: circleci/golang:1.13
- image: circleci/mariadb:10.3 - image: circleci/mariadb:10.3
command: [--default-authentication-plugin=mysql_native_password] command: [--default-authentication-plugin=mysql_native_password]
@ -138,17 +130,9 @@ jobs:
- run: - run:
name: Install dependencies name: Install dependencies
command: | command: |
go get github.com/google/uuid cd /go/src/github.com/go-jet/jet
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
go get github.com/jstemmer/go-junit-report go get github.com/jstemmer/go-junit-report
go build -o /home/circleci/.local/bin/jet ./cmd/jet/
go install github.com/go-jet/jet/cmd/jet
- run: - run:
name: Install MySQL CLI; name: Install MySQL CLI;
@ -172,7 +156,7 @@ jobs:
- run: - run:
name: Run MariaDB tests name: Run MariaDB tests
command: | command: |
go test -v ./tests/mysql/ -source=MariaDB MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/
workflows: workflows:
version: 2 version: 2

View file

@ -35,12 +35,7 @@ func TestGenerator(t *testing.T) {
} }
func TestCmdGenerator(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") err := os.RemoveAll(genTestDir3)
goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run()
require.NoError(t, err)
err = os.RemoveAll(genTestDir3)
require.NoError(t, err) require.NoError(t, err)
cmd := exec.Command("jet", "-source=MySQL", "-dbname=dvds", "-host=localhost", "-port=3306", cmd := exec.Command("jet", "-source=MySQL", "-dbname=dvds", "-host=localhost", "-port=3306",

View file

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

View file

@ -46,12 +46,7 @@ func TestGeneratedModel(t *testing.T) {
const genTestDir2 = "./.gentestdata2" const genTestDir2 = "./.gentestdata2"
func TestCmdGenerator(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") err := os.RemoveAll(genTestDir2)
goInstallJet.Stderr = os.Stderr
err := goInstallJet.Run()
require.NoError(t, err)
err = os.RemoveAll(genTestDir2)
require.NoError(t, err) require.NoError(t, err)
cmd := exec.Command("jet", "-source=PostgreSQL", "-dbname=jetdb", "-host=localhost", "-port=5432", cmd := exec.Command("jet", "-source=PostgreSQL", "-dbname=jetdb", "-host=localhost", "-port=5432",