Skip to content

Commit

Permalink
add lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Apr 16, 2024
1 parent cbfa6dd commit 6004080
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Lint
# This workflow is run on every pull request and push to master
# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed.
on:
pull_request:
paths:
- "**.go"
- "go.mod"
- "go.sum"
push:
branches:
- main
- "release/*"
paths:
- "**.go"
- "go.mod"
- "go.sum"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
golangci:
env:
# for private repo access
GOPRIVATE: github.com/initia-labs/*
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }}
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
go-version: 1.22
- uses: technote-space/get-diff-action@v5
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
# for private repo access
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.insteadOf https://github.com/
- name: run go linters
run: |
make tools
make lint
if: env.GIT_DIFF
# Use --check or --exit-code when available (Go 1.19?)
# https://github.com/golang/go/issues/27005
tidy:
env:
# for private repo access
GOPRIVATE: github.com/initia-labs/*
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }}
runs-on: ubuntu-latest
name: tidy
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: 1.22
# for private repo access
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.insteadOf https://github.com/
- run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ require (
pgregory.net/rapid v1.1.0 // indirect
)

replace (
github.com/initia-labs/OPinit/api => ./api
)
replace github.com/initia-labs/OPinit/api => ./api

replace (
// use cosmos fork of keyring
Expand Down

0 comments on commit 6004080

Please sign in to comment.