generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 8
39 lines (33 loc) · 1.46 KB
/
lint-go-reusable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This workflow defines a reusable Go linting flow, using Golangci-lint: https://golangci-lint.run/
# https://golangci-lint.run/usage/configuration/
name: Lint code (reusable)
on:
workflow_call:
inputs:
go-version:
required: true
type: string
description: "The Go version to use. This can be a specific version. E.g. 1.19 or 1.21.x"
lint-config-uri:
required: true
type: string
description: "The URI to the linter config file. This can be a local file or a remote file. E.g. https://raw.githubusercontent.com/kyma-project/eventing-tools/main/config/lint/.golangci.yaml"
jobs:
go-lint:
runs-on: ubuntu-latest
name: Lint Go Code
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }} # This can be a specific version. E.g. 1.19 or 1.21.x
cache: false # Disable cache to avoid issues with different Go versions
- name: Checkout code
uses: actions/checkout@v4
- name: Download linter config
run: wget -O .golangci.yaml ${{ inputs.lint-config-uri }} # This can be a remote file only. E.g. https://raw.githubusercontent.com/kyma-project/eventing-tools/main/config/lint/.golangci.yaml
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55
args: --timeout=5m --config=./.golangci.yaml --issues-exit-code 1 # Failed if any issues are found