-
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.
- Loading branch information
Showing
8 changed files
with
127 additions
and
3 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,74 @@ | ||
name: Linter | ||
|
||
# Run on every main merge and on PRs. | ||
on: | ||
push: | ||
branches: ["main"] | ||
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum"] | ||
pull_request: | ||
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum"] | ||
|
||
# Allow concurrent runs on main/release branches but isolates other branches | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21 | ||
cache: false # the golangci-lint action already caches for us (https://github.com/golangci/golangci-lint-action#performance) | ||
|
||
# Use GitHub actions output paramters to get go paths. For more info, see | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions | ||
- name: "Set output variables for go cache" | ||
id: go-cache-paths | ||
run: | | ||
echo "go-build-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | ||
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | ||
- name: "Go build cache" | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build-cache }} | ||
key: go-build-cache-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: "Go mod cache" | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod-cache }} | ||
key: go-mod-cache-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
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: v1.54.2 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
args: --fix=false --timeout=5m | ||
|
||
# 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 all caching functionality will be complete disabled, | ||
# takes precedence over all other caching options. | ||
# skip-cache: 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 |
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: PR lint | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, edited] | ||
|
||
jobs: | ||
pr-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: seferov/[email protected] | ||
with: | ||
# taken from https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c | ||
title-regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)' | ||
# title-regex-flags (Optional) | ||
title-regex-flags: "g" | ||
# error-message (Optional) | ||
error-message: "Please follow conventional commit style: https://www.conventionalcommits.org/en/v1.0.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,17 @@ | ||
name: Linter | ||
|
||
on: | ||
pull_request: | ||
# paths-ignore makes the action run when the given paths are unchanged | ||
# See "Handling skipped but required checks" in | ||
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks | ||
paths-ignore: ["**.go", "**.proto", "go.mod", "go.sum"] | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: skip-golangci | ||
run: | | ||
echo "job: golangci was skipped since Golang files were not changed." |
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