chore(ci): Run golangci-lint in GitHub Actions (#88916)

* chore(ci): Run golangci-lint in GitHub Actions

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* chore(ci): Remove lint-backend step from Drone

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
Dave Henderson 2024-06-07 12:30:31 -04:00 committed by GitHub
parent 58fdb24b0b
commit 3a8b59f5e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 39 deletions

View File

@ -433,15 +433,6 @@ steps:
depends_on: [] depends_on: []
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
name: wire-install name: wire-install
- commands:
- apk add --update make build-base
- make lint-go
depends_on:
- wire-install
environment:
CGO_ENABLED: "1"
image: golang:1.22.4-alpine
name: lint-backend
- commands: - commands:
- go run scripts/modowners/modowners.go check go.mod - go run scripts/modowners/modowners.go check go.mod
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -1760,15 +1751,6 @@ steps:
depends_on: [] depends_on: []
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
name: wire-install name: wire-install
- commands:
- apk add --update make build-base
- make lint-go
depends_on:
- wire-install
environment:
CGO_ENABLED: "1"
image: golang:1.22.4-alpine
name: lint-backend
- commands: - commands:
- go run scripts/modowners/modowners.go check go.mod - go run scripts/modowners/modowners.go check go.mod
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -4911,6 +4893,6 @@ kind: secret
name: gcr_credentials name: gcr_credentials
--- ---
kind: signature kind: signature
hmac: 7d2348a3bc09c44b08dda2d737f91c7de3e5048aa47ba65eada4cdde1eea9fa6 hmac: 08f38b820f97302de03a9fdfd39fb12c185bb36170704cf7591c16f33c3e4d31
... ...

1
.github/CODEOWNERS vendored
View File

@ -700,6 +700,7 @@ embed.go @grafana/grafana-as-code
/.github/workflows/i18n-crowdin-download.yml @grafana/grafana-frontend-platform /.github/workflows/i18n-crowdin-download.yml @grafana/grafana-frontend-platform
/.github/workflows/pr-go-workspace-check.yml @grafana/grafana-app-platform-squad /.github/workflows/pr-go-workspace-check.yml @grafana/grafana-app-platform-squad
/.github/workflows/run-scenes-e2e.yml @grafana/dashboards-squad /.github/workflows/run-scenes-e2e.yml @grafana/dashboards-squad
/.github/workflows/go_lint.yml @grafana/grafana-backend-services-squad
# Generated files not requiring owner approval # Generated files not requiring owner approval
/packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot /packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot

32
.github/workflows/go_lint.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: golangci-lint
on:
push:
paths:
- pkg/**
- .github/workflows/go_lint.yml
- go.*
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint-go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: CODEGEN_VERIFY=1 make gen-cue
- run: make gen-go
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: v1.59.0
args: --config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose
only-new-issues: true
skip-cache: true
install-mode: binary

View File

@ -7,7 +7,6 @@ load(
"compile_build_cmd", "compile_build_cmd",
"enterprise_setup_step", "enterprise_setup_step",
"identify_runner_step", "identify_runner_step",
"lint_backend_step",
"lint_drone_step", "lint_drone_step",
"validate_modfile_step", "validate_modfile_step",
"validate_openapi_spec_step", "validate_openapi_spec_step",
@ -45,7 +44,6 @@ def lint_backend_pipeline(trigger, ver_mode):
init_steps.append(wire_step) init_steps.append(wire_step)
test_steps = [ test_steps = [
lint_backend_step(),
validate_modfile_step(), validate_modfile_step(),
validate_openapi_spec_step(), validate_openapi_spec_step(),
] ]

View File

@ -199,24 +199,6 @@ def enterprise_downstream_step(ver_mode):
return step return step
def lint_backend_step():
return {
"name": "lint-backend",
"image": images["go"],
"environment": {
# We need CGO because of go-sqlite3
"CGO_ENABLED": "1",
},
"depends_on": [
"wire-install",
],
"commands": [
"apk add --update make build-base",
# Don't use Make since it will re-download the linters
"make lint-go",
],
}
def validate_modfile_step(): def validate_modfile_step():
return { return {
"name": "validate-modfile", "name": "validate-modfile",