-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
71 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
GOLANGCI_LINT_VERSION: v1.58 | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ["1.20", "1.21", "1.22"] | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
go-version: ${{ matrix.version }} | ||
- name: Test | ||
run: make test | ||
|
||
benchmark: | ||
name: Benchmark | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version-file: './go.mod' | ||
- name: Benchmark | ||
run: make bench | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
- name: tidy | ||
run: | | ||
make download | ||
git diff-index HEAD | ||
git diff --minimal --color=always --compact-summary --exit-code HEAD || FAILED=true ; | ||
if [[ $FAILED ]]; | ||
then echo "❗️please run \"go mod tidy\" locally and commit the changes" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
# Make this makefile self-documented with target `help` | ||
.PHONY: help | ||
|
||
help: ## Show help/documentation for the Makefile | ||
.DEFAULT_GOAL := help | ||
help: ## Show help | ||
@grep -Eh '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
configure: ## Download dependencies | ||
go mod download | ||
|
||
lint: configure ## Lint the repository with golang-ci lint | ||
.PHONY: lint | ||
lint: download ## Lint the repository with golang-ci lint | ||
golangci-lint run --max-same-issues 0 --max-issues-per-linter 0 $(if $(CI),--out-format code-climate > gl-code-quality-report.json 2>golangci-stderr-output) | ||
|
||
test: configure ## Run all tests | ||
.PHONY: test | ||
test: download ## Run all tests | ||
go test -v | ||
|
||
bench: configure ## Run all benchmarks | ||
.PHONY: bench | ||
bench: download ## Run all benchmarks | ||
go test -bench=. | ||
|
||
.PHONY: download | ||
download: ## Download dependencies | ||
go mod download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters