Skip to content

Commit 8d55404

Browse files
authored
Migrate to GitHub actions (#177)
* Bump to v2 * ci: migrate to github actions from circle-ci * ci: gotestsum shuffle & race * ci: replace deprecated linters * fix: linting issues & disable some linters * chore: remove circleci/config.yml * configure revive lint
1 parent 6136037 commit 8d55404

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+283
-261
lines changed

.circleci/config.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**/*.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**/*.md'
10+
11+
permissions:
12+
# Required: allow read access to the content for analysis.
13+
contents: read
14+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
15+
pull-requests: read
16+
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
17+
checks: write
18+
19+
jobs:
20+
golangci:
21+
name: lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-go@v5
27+
with:
28+
go-version: stable
29+
30+
- name: golangci-lint
31+
uses: golangci/golangci-lint-action@v6
32+
with:
33+
version: v1.59

.github/workflows/tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**/*.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**/*.md'
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
services:
15+
typesense:
16+
image: typesense/typesense:26.0
17+
ports:
18+
- 8108:8108/tcp
19+
volumes:
20+
- /tmp/typesense-server-data:/data
21+
env:
22+
TYPESENSE_DATA_DIR: '/data'
23+
TYPESENSE_API_KEY: 'test_key'
24+
TYPESENSE_ENABLE_CORS: true
25+
TYPESENSE_URL: 'http://localhost:8108'
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Setup Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: 'stable'
34+
35+
- name: Install dependencies
36+
run: go mod download
37+
38+
- name: Build
39+
run: go build -v ./...
40+
41+
- name: Run tests
42+
env:
43+
TYPESENSE_URL: 'http://localhost:8108'
44+
TYPESENSE_API_KEY: 'test_key'
45+
CGO_ENABLED: 1
46+
run: go run gotest.tools/gotestsum@latest --format github-actions -- -tags=integration ./... -race -shuffle=on

.golangci.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,26 @@ linters:
99
- gocyclo
1010
- gofmt
1111
- goimports
12-
- golint
1312
- gosec
14-
- maligned
1513
- misspell
1614
- nestif
1715
- prealloc
18-
- unconvert
16+
# - unconvert
1917
- unparam
20-
disable:
21-
- structcheck
18+
- revive
19+
20+
linters-settings:
21+
# govet:
22+
# enable:
23+
# - fieldalignment
24+
revive:
25+
rules:
26+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
27+
- name: var-naming
28+
severity: warning
29+
exclude: [""]
30+
arguments:
31+
- ["ID"] # AllowList
2232

2333
run:
2434
timeout: 3m
@@ -31,3 +41,7 @@ issues:
3141
- linters:
3242
- funlen
3343
path: _test\.go
44+
- linters:
45+
- errcheck
46+
path: _test\.go
47+

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# typesense-go
22

33
[![Build Status](https://cloud.drone.io/api/badges/typesense/typesense-go/status.svg)](https://cloud.drone.io/typesense/typesense-go)
4-
[![GoReportCard Status](https://goreportcard.com/badge/github.com/typesense/typesense-go)](https://goreportcard.com/report/github.com/typesense/typesense-go)
5-
[![Go Reference](https://pkg.go.dev/badge/github.com/typesense/typesense-go.svg)](https://pkg.go.dev/github.com/typesense/typesense-go)
4+
[![GoReportCard Status](https://goreportcard.com/badge/github.com/typesense/typesense-go/v2)](https://goreportcard.com/report/github.com/typesense/typesense-go/v2)
5+
[![Go Reference](https://pkg.go.dev/badge/github.com/typesense/typesense-go/v2.svg)](https://pkg.go.dev/github.com/typesense/typesense-go/v2)
66
[![GitHub release](https://img.shields.io/github/v/release/typesense/typesense-go)](https://github.com/typesense/typesense-go/releases/latest)
77
[![Gitter](https://badges.gitter.im/typesense-go/community.svg)](https://gitter.im/typesense-go/community)
88

@@ -11,15 +11,15 @@ Go client for the Typesense API: https://github.com/typesense/typesense
1111
## Installation
1212

1313
```
14-
go get github.com/typesense/typesense-go
14+
go get github.com/typesense/typesense-go/v2
1515
```
1616

1717
## Usage
1818

1919
Import the the package into your code :
2020

2121
```go
22-
import "github.com/typesense/typesense-go/typesense"
22+
import "github.com/typesense/typesense-go/v2/typesense"
2323
```
2424

2525
Create new client:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/typesense/typesense-go
1+
module github.com/typesense/typesense-go/v2
22

33
go 1.18
44

typesense/alias.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package typesense
33
import (
44
"context"
55

6-
"github.com/typesense/typesense-go/typesense/api"
6+
"github.com/typesense/typesense-go/v2/typesense/api"
77
)
88

99
// AliasInterface is a type for Alias API operations

typesense/alias_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"net/http"
77
"testing"
88

9-
"go.uber.org/mock/gomock"
109
"github.com/stretchr/testify/assert"
11-
"github.com/typesense/typesense-go/typesense/api"
12-
"github.com/typesense/typesense-go/typesense/mocks"
10+
"github.com/typesense/typesense-go/v2/typesense/api"
11+
"github.com/typesense/typesense-go/v2/typesense/mocks"
12+
"go.uber.org/mock/gomock"
1313
)
1414

1515
func TestCollectionAliasRetrieve(t *testing.T) {

typesense/aliases.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package typesense
33
import (
44
"context"
55

6-
"github.com/typesense/typesense-go/typesense/api"
6+
"github.com/typesense/typesense-go/v2/typesense/api"
77
)
88

99
// AliasesInterface is a type for Aliases API operations

typesense/aliases_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
"net/http"
77
"testing"
88

9-
"github.com/typesense/typesense-go/typesense/api/pointer"
9+
"github.com/typesense/typesense-go/v2/typesense/api/pointer"
1010

11-
"go.uber.org/mock/gomock"
1211
"github.com/jinzhu/copier"
1312
"github.com/stretchr/testify/assert"
14-
"github.com/typesense/typesense-go/typesense/api"
15-
"github.com/typesense/typesense-go/typesense/mocks"
13+
"github.com/typesense/typesense-go/v2/typesense/api"
14+
"github.com/typesense/typesense-go/v2/typesense/mocks"
15+
"go.uber.org/mock/gomock"
1616
)
1717

1818
func createNewCollectionAlias(collectionName string, name string) *api.CollectionAlias {

0 commit comments

Comments
 (0)