Skip to content

Fix Issues of golangci-lint (#37) #100

Fix Issues of golangci-lint (#37)

Fix Issues of golangci-lint (#37) #100

Workflow file for this run

name: Go Build, Test, and Analyze Pipeline
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
GO_VERSION: 1.21
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build
test:
name: Unit Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Unit Test with Mocking
run: make test_with_mock
lint:
name: Linting with golangci-lint
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
coverage:
name: Coverage and Codecov Upload
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run coverage
run: make test_ci_coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success()
analysis:
name: Codacy Analysis
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@master
if: success()
fuzz:
name: Fuzzing Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Fuzzing Tests
run: make test_fuzz