-
Notifications
You must be signed in to change notification settings - Fork 0
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
99 additions
and
0 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,41 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0 | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
- name: Install gofumpt | ||
run: go install mvdan.cc/gofumpt@v0.7.0 | ||
|
||
- name: Install dependencies | ||
run: make deps || exit 1 | ||
|
||
- name: Lint | ||
run: make lint || exit 1 | ||
|
||
- name: Check format | ||
run: make format || exit 1 | ||
|
||
- name: Run tests | ||
run: make test || exit 1 |
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 @@ | ||
run: {} |
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,51 @@ | ||
.DEFAULT_GOAL = check | ||
.PHONY: FORCE | ||
|
||
CC = /usr/local/musl/bin/musl-gcc | ||
GOFLAGS = -ldflags '-linkmode external -extldflags "-static"' | ||
OUTDIR = bin | ||
TESTGEN_BINARY = $(OUTDIR)/testgen | ||
|
||
build-testgen: $(TESTGEN_BINARY) | ||
.PHONY: build-testgen | ||
|
||
clean: | ||
rm -f $(TESTGEN_BINARY) | ||
.PHONY: clean | ||
|
||
format: | ||
gofumpt -l . | ||
@if gofumpt -l . | grep -q .; then \ | ||
exit 1; \ | ||
fi | ||
.PHONY: format | ||
|
||
format-fix: | ||
gofumpt -w . | ||
.PHONY: format-fix | ||
|
||
lint: | ||
golangci-lint run --config .golangci.yml | ||
.PHONY: lint | ||
|
||
lint-fix: | ||
golangci-lint run --fix --config .golangci.yml | ||
.PHONY: lint-fix | ||
|
||
test: | ||
go test -v -p=4 ./... | ||
.PHONY: test | ||
|
||
check: format lint test | ||
.PHONY: check | ||
|
||
$(TESTGEN_BINARY): FORCE | ||
@mkdir -p $(OUTDIR) | ||
CC=$(CC) go build $(GOFLAGS) -o $@ ./cmd/testgen/main.go | ||
|
||
deps: FORCE | ||
go mod tidy | ||
go mod verify | ||
|
||
all: clean deps | ||
.PHONY: all |
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,3 +1,5 @@ | ||
//go:build linux | ||
|
||
package main | ||
|
||
import ( | ||
|
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