Skip to content

Commit

Permalink
Merge pull request #129 from go-gormigrate/improve-ci]
Browse files Browse the repository at this point in the history
Upgrade Go / Improve CI / Add linting
  • Loading branch information
andreynering committed May 16, 2022
2 parents 0a65fe5 + 3e29b82 commit 3320fcc
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 15 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on:
pull_request:
push:
tags:
- v*
branches:
- master

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18

- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.1
12 changes: 9 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Test

on: [push, pull_request]
on:
pull_request:
push:
tags:
- v*
branches:
- master

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Install Task
uses: Arduino/actions/setup-taskfile@master
uses: arduino/setup-task@v1

- name: Check out code
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Test
run: task docker
13 changes: 4 additions & 9 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# https://taskfile.org
# https://taskfile.dev

version: '2'
version: '3'

tasks:
dl-deps:
desc: Downloads cli dependencies
cmds:
- go get -u golang.org/x/lint/golint

go-get-all:
cmds:
- go get -t -tags 'sqlite postgresql mysql sqlserver' ./...

lint:
desc: Runs golint on this project
desc: Runs golangci-lint
cmds:
- golint .
- golangci-lint run

test-sqlite:
desc: Run tests for SQLite
Expand Down
25 changes: 24 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/go-gormigrate/gormigrate/v2

go 1.15
go 1.17

require (
github.com/joho/godotenv v1.4.0
Expand All @@ -11,3 +11,26 @@ require (
gorm.io/driver/sqlserver v1.3.1
gorm.io/gorm v1.23.4
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisenkom/go-mssqldb v0.12.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.9.1 // indirect
github.com/jackc/pgx/v4 v4.14.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/mattn/go-sqlite3 v1.14.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
3 changes: 1 addition & 2 deletions gormigrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gormigrate

import (
"errors"
"fmt"
"testing"

_ "github.com/joho/godotenv/autoload"
Expand Down Expand Up @@ -409,7 +408,7 @@ func forEachDatabase(t *testing.T, fn func(database *gorm.DB), dialects ...strin

for _, database := range databases {
if len(dialects) > 0 && !contains(dialects, database.dialect) {
t.Skip(fmt.Sprintf("test is not supported by [%s] dialect", database.dialect))
t.Skipf("test is not supported by [%s] dialect", database.dialect)
}

// Ensure defers are not stacked up for each DB
Expand Down

0 comments on commit 3320fcc

Please sign in to comment.