-
Notifications
You must be signed in to change notification settings - Fork 12
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: hanenMizouni <[email protected]>
- Loading branch information
1 parent
573d366
commit 118770c
Showing
1 changed file
with
47 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
name: Lint Code | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Check out the repository | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensure full git history for accurate comparisons | ||
|
||
# Step 2: Set up Go environment | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
|
||
# Step 3: Cache Go Modules | ||
- name: Cache Go Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# Step 4: Install golangci-lint (if not already cached) | ||
- name: Install golangci-lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3 | ||
# Step 5: Run golangci-lint | ||
- name: Run golangci-lint | ||
run: | | ||
golangci-lint run --new-from-rev=origin/main --new-only --timeout=5m |