Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:
permissions:
contents: read # Optional: allow read access to pull requests
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: latest
args: --timeout 10m
only-new-issues: true
33 changes: 31 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
# copy of https://github.com/hashicorp/vault-workflows-common/blob/main/.github/workflows/tests.yaml
name: Run Tests

on:
push:
branches: [ "main" ]
pull_request:

permissions:
contents: read

jobs:
run-tests:
# using `main` as the ref will keep your workflow up-to-date
uses: hashicorp/vault-workflows-common/.github/workflows/tests.yaml@main
name: "Run Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version-file: .go-version

- name: Run Build
run: make dev

- name: Run Tests
run: make test

- name: Print Coverage Summary
# Parses the profile and prints per-function coverage to stdout
run: go tool cover -func=coverage.txt

- name: Archive code coverage results
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: code-coverage
path: coverage.txt
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*.a
*.so

coverage.*

# Folders
_obj
_test
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ bootstrap:
go mod edit -module github.com/hashicorp/$(REPO_DIR); \
fi

.PHONY: tools
tools:
@which gofumpt > /dev/null || (echo "Installing gofumpt..." && go install mvdan.cc/gofumpt@latest)
@which gotestsum > /dev/null || (echo "Installing gotestsum..." && go install gotest.tools/gotestsum@latest)

.PHONY: test
test: fmtcheck
CGO_ENABLED=0 go test ./... $(TESTARGS) -timeout=20m
test: tools fmtcheck
gotestsum --format github-actions \
-- ./... $(TESTARGS) -timeout=20m -race -coverprofile=coverage.txt

.PHONY: fmtcheck
.PHONY: tools fmtcheck
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

Expand Down