Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Pipeline

on:
push:
branches: [master]
pull_request:

jobs:
ci:
name: Vet, Lint, Test & Coverage
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}

steps:
- name: Check out code
uses: actions/checkout@v7.0.1
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}

- name: Set up Go
uses: actions/setup-go@v7.0.0
with:
go-version-file: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/go.mod

- name: Download dependencies
run: go mod download

- name: Check go mod tidy
run: |
go mod tidy
if ! git diff --exit-code go.mod go.sum; then
echo "go.mod or go.sum is not tidy. Run 'go mod tidy' and commit the result."
exit 1
fi

- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@v1.9.0
govulncheck ./...

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2

- name: Install counterfeiter
run: go install github.com/maxbrunsfeld/counterfeiter/v6@v6.12.2

- name: Check formatting
run: |
$GOPATH/bin/golangci-lint fmt --diff
if ! git diff --exit-code; then
echo "Code is not formatted. Run 'golangci-lint fmt' and commit the result."
exit 1
fi

- name: Run vet
run: go vet $(go list ./... | grep -v /vendor/)

- name: Run lint
run: $GOPATH/bin/golangci-lint run

- name: Validate generated fakes
run: |
go generate ./lib/provider/... ./provider/local/...
if ! git diff --exit-code; then
echo "Generated fakes are out of sync with interfaces. Run 'go generate ./lib/provider/... ./provider/local/...' and commit the result."
exit 1
fi

- name: Run tests with coverage
run: go test $(go list ./... | grep -v /vendor/) -race -covermode=atomic -coverprofile=cover.out -timeout 90m

- name: Install goveralls
run: go install github.com/mattn/goveralls@v0.0.12

- name: Send coverage
run: $GOPATH/bin/goveralls -coverprofile=cover.out -service=github
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 36 additions & 45 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
# all available settings of specific linters
linters-settings:
govet:
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
gosec:
settings:
exclude: "G401"
golint:
min-confidence: 0
report-comments: true
gocyclo:
min-complexity: 10
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
issues:
include: [EXC01, EXC02]
exclude-use-default: false
version: "2"

linters:
# enable or disable analyzers by name
enable:
- gofmt
- gosec
- whitespace
- misspell
- unconvert
- goimports
- unused
- gosimple
- bodyclose
- govet
- typecheck
- staticcheck
enable-all: false
disable-all: true
default: none
enable:
- gosec
- whitespace
- misspell
- unconvert
- unused
- bodyclose
- govet
- staticcheck
settings:
govet:
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/v2/pkg/logutils.Log).Fatalf
gosec:
excludes:
- G401
gocyclo:
min-complexity: 10
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2

formatters:
enable:
- gofmt
- goimports
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /samples)
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
ARCH = $(shell uname -m)
LINT_VERSION="1.60.1"
LINT_VERSION="2.12.2"

GOPATH := $(shell go env GOPATH)
LINT_BIN := $(GOPATH)/bin/golangci-lint

.PHONY: all
all: deps dofmt vet test

.PHONY: deps
deps:
go get github.com/pierrre/gotestcover
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v${LINT_VERSION}; \
@if [ ! -x "$(LINT_BIN)" ] || ! "$(LINT_BIN)" version 2>/dev/null | grep -q "version $(LINT_VERSION)"; then \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$(LINT_VERSION); \
fi

.PHONY: fmt
fmt:
golangci-lint run --disable-all --enable=gofmt --timeout 30m
$(LINT_BIN) fmt --no-config --enable=gofmt --diff

.PHONY: dofmt
dofmt:
golangci-lint run --disable-all --enable=gofmt --fix
$(LINT_BIN) fmt --no-config --enable=gofmt

.PHONY: lint
lint:
golangci-lint run
$(LINT_BIN) run

.PHONY: makefmt
makefmt:
Expand All @@ -34,10 +36,10 @@ makefmt:
test:
ifeq ($(ARCH), ppc64le)
# POWER
$(GOPATH)/bin/gotestcover -v -coverprofile=cover.out ${GOPACKAGES} -timeout 90m
go test -v -coverprofile=cover.out ${GOPACKAGES} -timeout 90m
else
# x86_64
$(GOPATH)/bin/gotestcover -v -race -coverprofile=cover.out ${GOPACKAGES} -timeout 90m
go test -v -race -coverprofile=cover.out ${GOPACKAGES} -timeout 90m
endif

.PHONY: coverage
Expand Down
58 changes: 27 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,73 +1,69 @@
module github.com/IBM/ibmcloud-volume-interface

go 1.26.9
go 1.26.10

require (
github.com/BurntSushi/toml v1.0.0
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.6.7
github.com/IBM/secret-common-lib v1.1.15
github.com/IBM/secret-utils-lib v1.1.16
github.com/IBM/secret-common-lib v1.1.17
github.com/IBM/secret-utils-lib v1.1.17
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/kelseyhightower/envconfig v1.4.0
github.com/prometheus/client_golang v1.23.2
github.com/stretchr/testify v1.11.1
github.com/stretchr/testify v1.12.1
go.uber.org/zap v1.20.0
)

require (
github.com/IBM/go-sdk-core/v5 v5.17.4 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/IBM/go-sdk-core/v5 v5.25.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gabriel-vasile/mimetype v1.4.16 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/errors v0.21.0 // indirect
github.com/go-openapi/errors v0.22.9 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/strfmt v0.22.1 // indirect
github.com/go-openapi/strfmt v0.27.4 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/go-playground/locales v0.14.2 // indirect
github.com/go-playground/universal-translator v0.18.2 // indirect
github.com/go-playground/validator/v10 v10.30.5 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/oklog/ulid/v2 v2.1.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.mongodb.org/mongo-driver v1.17.7 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.55.0 // indirect
golang.org/x/net v0.58.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/term v0.45.0 // indirect
golang.org/x/text v0.41.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/grpc v1.83.2 // indirect
google.golang.org/protobuf v1.36.11 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/crypto v0.58.0 // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/oauth2 v0.37.0 // indirect
golang.org/x/sys v0.49.0 // indirect
golang.org/x/term v0.47.0 // indirect
golang.org/x/text v0.43.0 // indirect
golang.org/x/time v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 // indirect
google.golang.org/grpc v1.84.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.35.4 // indirect
k8s.io/apimachinery v0.35.4 // indirect
Expand Down
Loading
Loading