-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
0 parents
commit 873d6fb
Showing
12 changed files
with
757 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 @@ | ||
github: [samber] |
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,44 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
tags: | ||
branches: | ||
pull_request: | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.3 | ||
stable: false | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest | ||
|
||
# Optional: working directory, useful for monorepos | ||
working-directory: ./ | ||
|
||
# Optional: golangci-lint command line arguments. | ||
args: --timeout 60s --max-same-issues 50 | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
|
||
# Optional: if set to true then the action will use pre-installed Go. | ||
# skip-go-installation: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true | ||
|
||
# optionally use a specific version of Go rather than the latest one | ||
go_version: '1.20.3' |
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,56 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
semver: | ||
type: string | ||
description: 'Semver (eg: v1.2.3)' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
if: github.triggering_actor == 'samber' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.3 | ||
stable: false | ||
|
||
- name: Test | ||
run: make test | ||
|
||
# remove tests in order to clean dependencies | ||
- name: Remove xxx_test.go files | ||
run: rm -rf *_test.go ./examples ./images | ||
|
||
# cleanup test dependencies | ||
- name: Cleanup dependencies | ||
run: go mod tidy | ||
|
||
- name: List files | ||
run: tree -Cfi | ||
- name: Write new go.mod into logs | ||
run: cat go.mod | ||
- name: Write new go.sum into logs | ||
run: cat go.sum | ||
|
||
- name: Create tag | ||
run: | | ||
git config --global user.name '${{ github.triggering_actor }}' | ||
git config --global user.email "${{ github.triggering_actor}}@users.noreply.github.com" | ||
git add . | ||
git commit --allow-empty -m 'bump ${{ inputs.semver }}' | ||
git tag ${{ inputs.semver }} | ||
git push origin ${{ inputs.semver }} | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ inputs.semver }} | ||
tag_name: ${{ inputs.semver }} |
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,37 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
tags: | ||
branches: | ||
pull_request: | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.20.3 | ||
stable: false | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Test | ||
run: make coverage | ||
|
||
- name: Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./cover.out | ||
flags: unittests | ||
verbose: true |
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,38 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/go | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=go | ||
|
||
### Go ### | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
### Go Patch ### | ||
/vendor/ | ||
/Godeps/ | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/go | ||
|
||
cover.out | ||
cover.html | ||
.vscode | ||
|
||
.idea/ |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Samuel Berthe | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,43 @@ | ||
|
||
BIN=go | ||
|
||
build: | ||
${BIN} build -v ./... | ||
|
||
test: | ||
go test -race -v ./... | ||
watch-test: | ||
reflex -t 50ms -s -- sh -c 'gotest -race -v ./...' | ||
|
||
bench: | ||
go test -benchmem -count 3 -bench ./... | ||
watch-bench: | ||
reflex -t 50ms -s -- sh -c 'go test -benchmem -count 3 -bench ./...' | ||
|
||
coverage: | ||
${BIN} test -v -coverprofile=cover.out -covermode=atomic . | ||
${BIN} tool cover -html=cover.out -o cover.html | ||
|
||
tools: | ||
${BIN} install github.com/cespare/reflex@latest | ||
${BIN} install github.com/rakyll/gotest@latest | ||
${BIN} install github.com/psampaz/go-mod-outdated@latest | ||
${BIN} install github.com/jondot/goweight@latest | ||
${BIN} install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
${BIN} get -t -u golang.org/x/tools/cmd/cover | ||
${BIN} install github.com/sonatype-nexus-community/nancy@latest | ||
go mod tidy | ||
|
||
lint: | ||
golangci-lint run --timeout 60s --max-same-issues 50 ./... | ||
lint-fix: | ||
golangci-lint run --timeout 60s --max-same-issues 50 --fix ./... | ||
|
||
audit: | ||
${BIN} list -json -m all | nancy sleuth | ||
|
||
outdated: | ||
${BIN} list -u -m -json all | go-mod-outdated -update -direct | ||
|
||
weight: | ||
goweight |
Oops, something went wrong.