-
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.
ci: 💚 consolidate github actions workflows (#47)
- make all main jobs as reusable workflows - update used actions versions - use golangci-lint action for linting
- Loading branch information
Showing
8 changed files
with
210 additions
and
139 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: "Go: Build" | ||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
cache: false | ||
go-version-file: go.mod | ||
|
||
|
||
- id: go-cache-paths | ||
run: | | ||
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
mkdir -p "$(go env GOMODCACHE)" | ||
mkdir -p "$(go env GOCACHE)" | ||
- name: Go Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-gobuild-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-gobuild-build | ||
- name: Go Mod Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-gomod-build-${{ hashFiles('**/go.sum') }} | ||
|
||
- run: | | ||
go build -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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Go: Lint" | ||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
cache: false | ||
go-version-file: go.mod | ||
|
||
|
||
- name: Run golangci-lint | ||
id: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 |
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 @@ | ||
name: "Go: Test" | ||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
cache: false | ||
go-version-file: go.mod | ||
|
||
|
||
- name: Determine Go Cache Paths | ||
id: go-cache-paths | ||
run: | | ||
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
mkdir -p "$(go env GOMODCACHE)" | ||
mkdir -p "$(go env GOCACHE)" | ||
- name: Go Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-gobuild-test-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-gobuild-test | ||
- name: Go Mod Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-gomod-test-${{ hashFiles('**/go.sum') }} | ||
|
||
- run: | | ||
go test -v \ | ||
-coverprofile=coverage.txt \ | ||
-covermode=atomic \ | ||
-coverpkg=./... \ | ||
./... | ||
- name: Collect Code Coverage | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
file: ./coverage.txt |
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,20 @@ | ||
name: Go | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: "Go: Lint" | ||
uses: ./.github/workflows/go-lint.yaml | ||
|
||
build: | ||
name: "Go: Build" | ||
uses: ./.github/workflows/go-build.yaml | ||
|
||
test: | ||
name: "Go: Test" | ||
uses: ./.github/workflows/go-test.yaml | ||
|
||
secrets: inherit |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: "Markdown: Lint" | ||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: markdownlint | ||
uses: nosborn/github-action-markdown-cli@v2 | ||
with: | ||
files: . |
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,10 @@ | ||
name: Markdown | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: "Markdown: Lint" | ||
uses: ./.github/workflows/markdown-lint.yaml |
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,54 @@ | ||
linters: | ||
# Disable all default linters and enable only revive and formatters before | ||
# new findings by default linters are addressed. | ||
disable-all: true | ||
enable: | ||
- gofumpt | ||
- goimports | ||
- revive | ||
|
||
issues: | ||
exclude-use-default: false | ||
|
||
linters-settings: | ||
revive: | ||
confidence: 0.8 | ||
ignore-generated-header: false | ||
severity: error | ||
|
||
rules: | ||
- name: blank-imports | ||
- name: confusing-naming | ||
- name: confusing-results | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: deep-exit | ||
- name: dot-imports | ||
- name: empty-block | ||
- name: empty-lines | ||
- name: error-naming | ||
- name: error-return | ||
- name: error-strings | ||
- name: errorf | ||
- name: exported | ||
- name: get-return | ||
- name: if-return | ||
- name: import-shadowing | ||
- name: increment-decrement | ||
- name: indent-error-flow | ||
- name: modifies-parameter | ||
- name: modifies-value-receiver | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: redefines-builtin-id | ||
- name: struct-tag | ||
- name: superfluous-else | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: unnecessary-stmt | ||
- name: unreachable-code | ||
- name: unused-parameter | ||
- name: unused-receiver | ||
- name: var-declaration | ||
- name: var-naming |