Skip to content

Commit

Permalink
chore: added github-action for golangci-lint (#10)
Browse files Browse the repository at this point in the history
* added github-action for golangci-lint

* refactor 1

* change the file struct

* removed un-wanted folder

* added a path for main.go

* debug 1

* adding lint for each folder

* adding install mode

* changing the go version

* changing the go version

* changing the installation mode

* changing the go version

* adding args

* adding args

* adding args

* debug -1

* debug-2

* debug-3

* debug-4

* debug-5

* debug-6

* debug-7

* debug-8

* debug-9

* debug-10

* debug-11

* debug-12

* debug-13

* debug-14

* debug-15

* debug-16

* debug-17

* debug-18

* adding comments

* checking if action is working-or not

* reverting

---------

Co-authored-by: Badal Kumar Prusty <[email protected]>
  • Loading branch information
badal773 and Badal Kumar Prusty authored Oct 16, 2024
1 parent 04f5251 commit a960335
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 48 deletions.
48 changes: 0 additions & 48 deletions .github/workflow/multi-gitter-pr-sync.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Workflow name: Go Linter (golangci-lint)
name: Go Linter

# Trigger the workflow on pull request events
on:
pull_request:
types: [opened, edited, reopened, synchronize]
branches:
- 'main'
- 'rc-*'
- 'hotfix-*'
- 'develop'

# Set permissions for the GITHUB_TOKEN
permissions:
contents: read # Only read access to the repository contents is needed for linting

# Define the jobs to run
jobs:
golangci-lint:
name: Lint Go Code
runs-on: ubuntu-latest
strategy:
matrix:
# Define the directories to run linting on
working-directory: [common-lib, authenticator, chart-sync, kubewatch, git-sensor, kubelink, lens]

steps:
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v4

# Step 2: Set up Go environment
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable # Use the latest stable version of Go

# Step 3: Install dependencies for common-lib (if applicable)
- name: Install common-lib dependencies
if: ${{ matrix.working-directory == 'common-lib' }}
run: |
cd common-lib
go get oras.land/oras-go/pkg/auth/docker
go mod tidy
go mod download
go mod vendor
# Step 4: Run golangci-lint
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61 # Specify the version of golangci-lint to use
args: --timeout=30m --tests=false --verbose # Set linting arguments
only-new-issues: "true" # Only report new issues
working-directory: ${{ matrix.working-directory }} # Set the working directory based on the matrix

0 comments on commit a960335

Please sign in to comment.