forked from sergi/go-diff
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update repo and dependencies (#1)
Release new forked version with no security issue
- Loading branch information
1 parent
849d7eb
commit 46eaa6f
Showing
18 changed files
with
903 additions
and
590 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,53 @@ | ||
name: Go | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "images/**" | ||
- "**/*.md" | ||
branches: | ||
- main | ||
push: | ||
paths-ignore: | ||
- "images/**" | ||
- "**/*.md" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
name: Run linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19.x | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: "latest" | ||
args: -c ./golangci.yml | ||
- name: Format lint | ||
run: | | ||
make install-tools && make format && git diff --quiet | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go: | ||
[ | ||
"1.16.x", | ||
"1.17.x", | ||
"1.18.x", | ||
"1.19.x", | ||
] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{matrix.go}} | ||
- name: Run Tests | ||
run: make test |
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,44 +1,23 @@ | ||
.PHONY: all clean clean-coverage install install-dependencies install-tools lint test test-verbose test-with-coverage | ||
.PHONY: install-tools lint test test-verbose format benchmark | ||
|
||
export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) | ||
export PKG := github.com/sergi/go-diff | ||
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets | ||
export ARGS | ||
|
||
ifdef ARGS | ||
PKG_TEST := $(ARGS) | ||
else | ||
PKG_TEST := $(PKG)/... | ||
endif | ||
|
||
all: install-tools install-dependencies install lint test | ||
|
||
clean: | ||
go clean -i $(PKG)/... | ||
go clean -i -race $(PKG)/... | ||
clean-coverage: | ||
find $(ROOT_DIR) | grep .coverprofile | xargs rm | ||
install: | ||
go install -v $(PKG)/... | ||
install-dependencies: | ||
go get -t -v $(PKG)/... | ||
go build -v $(PKG)/... | ||
install-tools: | ||
# Install linting tools | ||
go get -u -v golang.org/x/lint/... | ||
go get -u -v github.com/kisielk/errcheck/... | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
go install mvdan.cc/gofumpt@latest | ||
go install github.com/segmentio/golines@latest | ||
|
||
# Install code coverage tools | ||
go get -u -v github.com/onsi/ginkgo/ginkgo/... | ||
go get -u -v github.com/modocache/gover/... | ||
go get -u -v github.com/mattn/goveralls/... | ||
lint: | ||
$(ROOT_DIR)/scripts/lint.sh | ||
golangci-lint run -c ./golangci.yml ./... | ||
|
||
format: | ||
gofumpt -l -w -extra . | ||
golines . -w | ||
|
||
test: | ||
go test -race -test.timeout 120s $(PKG_TEST) | ||
go test -race -test.timeout 120s -count=1 ./... | ||
|
||
test-verbose: | ||
go test -race -test.timeout 120s -v $(PKG_TEST) | ||
test-with-coverage: | ||
ginkgo -r -cover -race -skipPackage="testdata" | ||
go test -race -test.timeout 120s -v -cover -count=1 ./... | ||
|
||
benchmark: | ||
go test -bench=. -benchmem ./... |
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
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
Oops, something went wrong.