-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved to go 1.12 * Moved to goreleaser * Moved to github actions * Formatted code * Vetted code with golangci * Moved to taskfile * Removed io/ioutil
- Loading branch information
Showing
29 changed files
with
375 additions
and
167 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,15 @@ | ||
--- | ||
name: Cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: delete branch | ||
uses: SvanBoxel/delete-merged-branch@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,28 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Test | ||
run: task test |
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,21 @@ | ||
--- | ||
name: Greetings | ||
|
||
on: [pull_request, issues] | ||
|
||
jobs: | ||
greeting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/first-interaction@v1 | ||
if: env.month != 'Oct' | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: 'Thank you for your first issue! 😊🕹️' | ||
pr-message: 'Thank you for contributing to this project! 😊🕹️' | ||
- uses: actions/first-interaction@v1 | ||
if: env.month == 'Oct' | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: 'Thank you for your first issue! Happy Hacktoberfest!!! 🎃👕🕹️' | ||
pr-message: 'Thank you for contributing to this project. Happy Hacktoberfest!!! 🎃👕🕹️' |
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,18 @@ | ||
--- | ||
name: Mark stale issues and pull requests | ||
|
||
on: | ||
schedule: | ||
- cron: "30 1 * * *" | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v3 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'Stale issue message' | ||
stale-pr-message: 'Stale pull request message' | ||
stale-issue-label: 'no-issue-activity' | ||
stale-pr-label: 'no-pr-activity' |
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,3 @@ | ||
.build/ | ||
coverage* | ||
test/integration/tmp/ | ||
cobertura.xml | ||
cover.out | ||
result.xml |
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,30 @@ | ||
# Refer to golangci-lint's example config file for more options and information: | ||
# https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml | ||
|
||
run: | ||
timeout: 5m | ||
modules-download-mode: readonly | ||
skip-dirs: | ||
- .asdf | ||
|
||
linters: | ||
enable: | ||
- errcheck | ||
- errname | ||
- goimports | ||
- govet | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- staticcheck | ||
|
||
linters-settings: | ||
revive: | ||
rules: | ||
- name: package-comments | ||
disabled: true | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
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,26 @@ | ||
--- | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
ldflags: | ||
- -s -w -X {{ .ModulePath }}/cmd.date={{ .CommitDate }} | ||
- -X {{ .ModulePath }}/cmd.commit={{ .Commit }} | ||
- -X {{ .ModulePath }}/cmd.version={{ .Version }} | ||
archives: | ||
- format: binary | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^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
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,92 @@ | ||
--- | ||
version: "3" | ||
|
||
vars: | ||
GIT_ROOT: | ||
sh: git rev-parse --show-toplevel | ||
MAIN_PACKAGE: main.go | ||
|
||
tasks: | ||
deps: | ||
desc: Install dependencies | ||
cmds: | ||
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | ||
- go install github.com/princjef/gomarkdoc/cmd/[email protected] | ||
- go install golang.org/x/vuln/cmd/[email protected] | ||
- go install github.com/jstemmer/[email protected] | ||
- go install github.com/segmentio/[email protected] | ||
- go install github.com/golang/mock/[email protected] | ||
- go install github.com/boumenot/[email protected] | ||
- go install mvdan.cc/gofumpt@fd93f1d8818fc86a956b9706ad8b81734c81cc1e | ||
- go install github.com/goreleaser/goreleaser@latest | ||
|
||
mod: | ||
desc: Module maintenance | ||
cmds: | ||
- go mod download | ||
- go mod tidy | ||
|
||
vet: | ||
desc: Report likely mistakes in packages | ||
cmds: | ||
- $(go env GOPATH)/bin/golangci-lint run --config {{ .GIT_ROOT }}/.golangci.yml | ||
|
||
vuln: | ||
desc: Run Go's vulnerability scanner | ||
cmds: | ||
- govulncheck ./... | ||
|
||
run: | ||
desc: Compile and run Go program | ||
cmds: | ||
- go run {{ .MAIN_PACKAGE }} {{.CLI_ARGS}} | ||
|
||
unit: | ||
desc: Test packages | ||
cmds: | ||
- go test -parallel 5 -race -v ./... | ||
|
||
unit:int: | ||
desc: Integration test packages | ||
cmds: | ||
- go test -tags=integration -parallel 5 -race -v ./... | ||
|
||
test: | ||
desc: Test all | ||
cmds: | ||
- task: deps | ||
- task: mod | ||
- task: fmt:check | ||
- task: vet | ||
- task: cov | ||
- task: unit:int | ||
|
||
cov: | ||
desc: Generate coverage | ||
cmds: | ||
- go test -race -coverprofile cover.out -v 2>&1 ./... | go-junit-report --set-exit-code > result.xml || (cat result.xml && echo "fail" && exit 1) | ||
- $(go env GOPATH)/bin/gocover-cobertura < cover.out > cobertura.xml | ||
|
||
covmap: | ||
desc: Generate coverage and show heatmap | ||
cmds: | ||
- task: cov | ||
- go tool cover -html=cover.out | ||
|
||
fmt: | ||
desc: Reformat files whose formatting differs from `go_fmt_command` | ||
cmds: | ||
- gofumpt -l -w . | ||
- golines --base-formatter=gofumpt -w . | ||
|
||
fmt:check: | ||
desc: Check files whose formatting differs from `go_fmt_command` | ||
cmds: | ||
# https://github.com/mvdan/gofumpt/issues/114 | ||
- test -z "$(gofumpt -d -e . | tee /dev/stderr)" | ||
- test -z "$(golines -l --dry-run --base-formatter=gofumpt -w .)" | ||
|
||
build: | ||
desc: Build ARCH compatible binary. | ||
cmds: | ||
- goreleaser release --snapshot --clean |
Oops, something went wrong.