-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduce CircleCI With this PR, we introduce the CircleCI as a CI pipeline. The old configuration, TravisCI, is removed. A Makefile is also created to allow easier interaction with the different commands available. * Fix all linting issues * Fix goimports version
- Loading branch information
Showing
18 changed files
with
236 additions
and
84 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,140 @@ | ||
version: 2.1 | ||
|
||
"-": &go-versions | ||
[ "1.18.10", "1.19.13", "1.20.14", "1.21.9", "1.22.2" ] | ||
|
||
executors: | ||
go_executor: | ||
parameters: | ||
version: | ||
type: string | ||
docker: | ||
- image: cimg/go:<< parameters.version >> | ||
|
||
jobs: | ||
test: | ||
parameters: | ||
go_version: | ||
type: string | ||
executor: | ||
name: go_executor | ||
version: << parameters.go_version >> | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-mod-v4-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install Dependencies | ||
command: go mod download | ||
- save_cache: | ||
key: go-mod-v4-{{ checksum "go.sum" }} | ||
paths: | ||
- "/go/pkg/mod" | ||
- run: | ||
name: Run tests | ||
command: | | ||
mkdir -p /tmp/test-reports | ||
gotestsum --junitfile /tmp/test-reports/unit-tests.xml | ||
- store_test_results: | ||
path: /tmp/test-reports | ||
test-race: | ||
parameters: | ||
go_version: | ||
type: string | ||
executor: | ||
name: go_executor | ||
version: << parameters.go_version >> | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-mod-v4-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install Dependencies | ||
command: go mod download | ||
- save_cache: | ||
key: go-mod-v4-{{ checksum "go.sum" }} | ||
paths: | ||
- "/go/pkg/mod" | ||
- run: | ||
name: Run tests with race detector | ||
command: make test-race | ||
lint: | ||
parameters: | ||
go_version: | ||
type: string | ||
executor: | ||
name: go_executor | ||
version: << parameters.go_version >> | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-mod-v4-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install Dependencies | ||
command: go mod download | ||
- run: | ||
name: Install tooling | ||
command: | | ||
make tooling | ||
- save_cache: | ||
key: go-mod-v4-{{ checksum "go.sum" }} | ||
paths: | ||
- "/go/pkg/mod" | ||
- run: | ||
name: Linting | ||
command: make lint | ||
- run: | ||
name: Running vulncheck | ||
command: make vuln-check | ||
fmt: | ||
parameters: | ||
go_version: | ||
type: string | ||
executor: | ||
name: go_executor | ||
version: << parameters.go_version >> | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-mod-v4-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install Dependencies | ||
command: go mod download | ||
- run: | ||
name: Install tooling | ||
command: | | ||
make tooling | ||
- save_cache: | ||
key: go-mod-v4-{{ checksum "go.sum" }} | ||
paths: | ||
- "/go/pkg/mod" | ||
- run: | ||
name: Running formatting | ||
command: | | ||
make fmt | ||
make has-changes | ||
workflows: | ||
version: 2 | ||
build-and-test: | ||
jobs: | ||
- test: | ||
matrix: | ||
parameters: | ||
go_version: *go-versions | ||
- test-race: | ||
matrix: | ||
parameters: | ||
go_version: *go-versions | ||
- lint: | ||
matrix: | ||
parameters: | ||
go_version: *go-versions | ||
- fmt: | ||
matrix: | ||
parameters: | ||
go_version: *go-versions |
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,30 @@ | ||
.ONESHELL: | ||
SHELL = /bin/sh | ||
.SHELLFLAGS = -ec | ||
|
||
BASE_PACKAGE := github.com/jmoiron/sqlx | ||
|
||
tooling: | ||
go install honnef.co/go/tools/cmd/staticcheck@v0.4.7 | ||
go install golang.org/x/vuln/cmd/govulncheck@v1.0.4 | ||
go install golang.org/x/tools/cmd/goimports@v0.20.0 | ||
|
||
has-changes: | ||
git diff --exit-code --quiet HEAD -- | ||
|
||
lint: | ||
go vet ./... | ||
staticcheck -checks=all ./... | ||
|
||
fmt: | ||
go list -f '{{.Dir}}' ./... | xargs -I {} goimports -local $(BASE_PACKAGE) -w {} | ||
|
||
vuln-check: | ||
govulncheck ./... | ||
|
||
test-race: | ||
go test -v -race -count=1 ./... | ||
|
||
update-dependencies: | ||
go get -u -t -v ./... | ||
go mod tidy |
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
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build go1.8 | ||
// +build go1.8 | ||
|
||
package sqlx | ||
|
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
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
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
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
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
Oops, something went wrong.