-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: apostasie <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
33 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 |
---|---|---|
@@ -1,26 +1,45 @@ | ||
name: "Go lint" | ||
name: "lint-go" | ||
description: "This action will install go linting tools (golangci-lint and goimports-reviser), and executes them on the codebase." | ||
inputs: | ||
cache-dependency-path: | ||
description: 'Used to specify the path to a dependency file - go.sum' | ||
strategy: | ||
description: "See intall-go for info" | ||
description: "See install-go for info" | ||
goos: | ||
description: "The GOOS we want to lint for" | ||
_golangci_version: | ||
description: "Internal: the golangci version we want" | ||
default: "89476e7a1eaa0a8a06c17343af960a5fd9e7edb7" # v1.62.2 | ||
_goimports_version: | ||
description: "Internal: the goimports reviser version we want" | ||
default: "f034195cc8a7ffc7cc70d60aa3a25500874eaf04" # v3.8.2 | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: "Install go" | ||
- name: "Install golang" | ||
uses: ./.github/actions/install-go | ||
with: | ||
strategy: ${{ inputs.strategy }} | ||
- name: "Run golangci-lint" | ||
uses: golangci/golangci-lint-action@774c35bcccffb734694af9e921f12f57d882ef74 # v6.1.1 | ||
with: | ||
args: --verbose | ||
skip-save-cache: true | ||
skip-cache: true | ||
- name: "Check that go imports ordering is ok" | ||
- name: "`go install` needed tools" | ||
shell: bash | ||
run: | | ||
err="$(go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@${{ inputs._golangci_version }} 2>&1)" || { | ||
echo "Failed installing golangci:" | ||
echo "$err" | ||
} | ||
err="$(go install -v github.com/incu6us/goimports-reviser/v3@${{ inputs._goimports_version }} 2>&1)" || { | ||
echo "Failed installing goimports-reviser:" | ||
echo "$err" | ||
} | ||
- name: "`make lint-imports`" | ||
# Import ordering is not influenced by GOOS - running it multiple times is thus unnecessary | ||
# Note we are picking freebsd as the GOOS to run it on, as linux is running multiple times (eg: canary) | ||
if: ${{ inputs.goos=='freebsd' }} | ||
shell: bash | ||
run: | | ||
go install -v github.com/incu6us/goimports-reviser/v3@f034195cc8a7ffc7cc70d60aa3a25500874eaf04 # v3.8.2 | ||
make lint-imports | ||
- name: "`make lint-go` for ${{ inputs.goos }} and $GO_VERSION" | ||
shell: bash | ||
run: | | ||
VERBOSE=true GOOS=${{ inputs.goos }} make lint-go |
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