Skip to content

Commit d91ef88

Browse files
committed
Migrate to GitHub Actions
* Use currently supported Go versions only * Added "build" to verify it builds correctly * `golint` and `megacheck` are deprecated. Dropped in favour of `go tool vet` and `staticcheck`. * Minor changes to make sure some checks pass
1 parent 60331c9 commit d91ef88

File tree

6 files changed

+103
-20
lines changed

6 files changed

+103
-20
lines changed

.github/workflows/ci.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build-and-test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go:
16+
- "1.16"
17+
- "1.17"
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Set up Go ${{ matrix.go }}
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
26+
- name: Install dependencies
27+
run: |
28+
go install github.com/cockroachdb/crlfmt@latest
29+
go install github.com/kisielk/errcheck@latest
30+
go install github.com/mdempsky/unconvert@latest
31+
go install honnef.co/go/tools/cmd/staticcheck@latest
32+
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
33+
34+
35+
- name: Build
36+
run: go build -v ./...
37+
38+
- name: Test
39+
run: go test -v ./...
40+
- name: Race
41+
run: go test -p 1 -v ./...
42+
- name: gofmt
43+
run: gofmt -s -d -l .
44+
- name: vet
45+
run: |
46+
! go vet -vettool=$(which shadow) ./... 2>&1 | \
47+
grep -vF 'declaration of "err" shadows declaration at' | \
48+
grep -vF "# github.com/cockroachdb/cockroach-go/v2/testserver"
49+
- name: License checks
50+
run: |
51+
! git grep -lE '^// Author' -- '*.go'
52+
! git grep -LE '^// Copyright' -- '*.go'
53+
- name: errchk
54+
run: errcheck -ignore "Close|Init|AutoMigrate" ./...
55+
- name: unconvert
56+
run: unconvert ./...
57+
- name: staticcheck
58+
run: staticcheck ./...

.travis.yml

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

crdb/crdbsqlx/sqlx.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2016 The Cockroach Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
// implied. See the License for the specific language governing
13+
// permissions and limitations under the License.
14+
115
package crdbsqlx
216

317
import (

crdb/crdbsqlx/sqlx_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2016 The Cockroach Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
// implied. See the License for the specific language governing
13+
// permissions and limitations under the License.
14+
115
package crdbsqlx
216

317
import (

crdb/error.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2016 The Cockroach Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
// implied. See the License for the specific language governing
13+
// permissions and limitations under the License.
14+
115
package crdb
216

317
import "fmt"

testserver/tenant.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ func (ts *testServerImpl) NewTenantServer(proxy bool) (TestServer, error) {
210210
}
211211

212212
tenantDB, err := sql.Open("postgres", tenantURL.String())
213+
if err != nil {
214+
return nil, err
215+
}
213216
defer tenantDB.Close()
214217

215218
rootPassword := ""

0 commit comments

Comments
 (0)