-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from doug-martin/gh_actions
Add github actions
- Loading branch information
Showing
3 changed files
with
86 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Go | ||
on: | ||
push: | ||
branches: # Array of patterns that match refs/heads | ||
- master # Push events on master branch | ||
- releases/* # Push events to branches matching refs/heads/releases/* | ||
pull_request: # Specify a second event with pattern matching | ||
jobs: | ||
test: | ||
name: Test go ${{ matrix.go_version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go_version: ["1.10", "1.11", "latest"] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v1 | ||
- name: Test | ||
env: | ||
GO_VERSION: ${{ matrix.go_version }} | ||
run: docker-compose run goqu-coverage | ||
- name: Upload coverage to Codecov | ||
run: bash <(curl -s https://codecov.io/bash) -n $GO_VERSION -e GO_VERSION,GITHUB_WORKFLOW,GITHUB_ACTION | ||
env: | ||
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} | ||
GO_VERSION: ${{ matrix.go_version }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package goqu | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/DATA-DOG/go-sqlmock" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type ( | ||
dialectWrapperSuite struct { | ||
suite.Suite | ||
} | ||
) | ||
|
||
func (dws *dialectWrapperSuite) SetupSuite() { | ||
testDialect := DefaultDialectOptions() | ||
// override to some value to ensure correct dialect is set | ||
RegisterDialect("test", testDialect) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TearDownSuite() { | ||
DeregisterDialect("test") | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestFrom() { | ||
dw := Dialect("test") | ||
dws.Equal(From("table").WithDialect("test"), dw.From("table")) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestSelect() { | ||
dw := Dialect("test") | ||
dws.Equal(Select("col").WithDialect("test"), dw.Select("col")) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestInsert() { | ||
dw := Dialect("test") | ||
dws.Equal(Insert("table").WithDialect("test"), dw.Insert("table")) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestDelete() { | ||
dw := Dialect("test") | ||
dws.Equal(Delete("table").WithDialect("test"), dw.Delete("table")) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestTruncate() { | ||
dw := Dialect("test") | ||
dws.Equal(Truncate("table").WithDialect("test"), dw.Truncate("table")) | ||
} | ||
|
||
func (dws *dialectWrapperSuite) TestDB() { | ||
mDb, _, err := sqlmock.New() | ||
dws.Require().NoError(err) | ||
dw := Dialect("test") | ||
dws.Equal(New("test", mDb), dw.DB(mDb)) | ||
} | ||
|
||
func TestDialectWrapper(t *testing.T) { | ||
suite.Run(t, new(dialectWrapperSuite)) | ||
} |