-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enable github actions validation (#36)
Enable github actions validation of code and remove travis build status from README.md as travis is no longer in use. Fix lint errors from gofumpt, this includes switching from []struct with a name to map[string]struct for tests, which results in clearer subtest definition. Also: * Remove deprecated linters * Enabling new useful linters ones applying the needed fixes. * Use bash for cache path step to prevent different commands from being needed on Windows.
- Loading branch information
Showing
13 changed files
with
216 additions
and
97 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 @@ | ||
*.go text eol=lf |
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,74 @@ | ||
name: Go build, test and lint | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
pull_request: | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
go: | ||
strategy: | ||
matrix: | ||
go: [1.19] | ||
golangcli: [v1.50.1] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
name: lint | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Setup | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Go Cache Paths | ||
id: go-cache-paths | ||
shell: bash | ||
run: | | ||
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
- name: Go Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.GOCACHE }} | ||
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Go Mod Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }} | ||
key: ${{ runner.os }}-GOMODCACHE-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Go Lint Standard | ||
if: runner.os != 'Windows' | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: ${{ matrix.golangci }} | ||
args: "--out-${NO_FUTURE}format colored-line-number" | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
|
||
- name: Go Lint Windows | ||
if: runner.os == 'Windows' | ||
uses: golangci/golangci-lint-action@v3 | ||
env: | ||
outformat: out-format | ||
with: | ||
version: ${{ matrix.golangci }} | ||
args: "--%outformat% colored-line-number" | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
|
||
- name: Go Build | ||
run: go build ./... | ||
|
||
- name: Go Test | ||
run: go test -race -v ./... |
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
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
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
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.