Skip to content

Commit

Permalink
add generate and tidy jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed Aug 4, 2024
1 parent 0093776 commit 8a58d74
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/golang_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -19,4 +19,32 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
working-directory: "${{ inputs.workdir }}"
working-directory: "${{ inputs.workdir }}"
go_tidy:
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/')"
container:
image: cubicrootxyz/golang-ci:v1.22.5-3
options: --user root
steps:
- uses: actions/checkout@v4
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Run go mod tidy
run: (cd ${{ inputs.workdir }} && go mod tidy)
- name: Run git diff
run: git diff --exit-code
go_generate:
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/')"
container:
image: cubicrootxyz/golang-ci:v1.22.5-3
options: --user root
steps:
- uses: actions/checkout@v4
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install mockgen
run: go install github.com/golang/mock/[email protected]
- name: Run go generate
run: go generate ${{ inputs.workdir }}...
- name: Run git diff
run: git diff --exit-code
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ jobs:
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
```
## Golang
### Code Quality
To ensure code quality use the provided `golang_quality` workflow. It runs multiple analysis tools.

```yaml
jobs:
golang_quality:
uses: ./.github/workflows/golang_quality.yaml
with:
workdir: "golang/application/subfolder"
```

0 comments on commit 8a58d74

Please sign in to comment.