fix linter errors and enable linter #35
This file contains hidden or 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
name: Build and Test Workflow | |
on: | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 30 | |
matrix: | |
version: | |
- 'oldstable' | |
- 'stable' | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: ${{ matrix.version }} | |
- name: Test Go | |
run: go test -v -coverprofile=coverage.out ./... | |
- name: Upload coverage report | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.6.2 | |
with: | |
path: coverage.out | |
name: coverage-report-${{matrix.version}} | |
- name: Display coverage report | |
run: go tool cover -func=coverage.out | |
lint: | |
name: Lint for target ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 30 | |
matrix: | |
target: [linux-amd64, windows-amd64, darwin-arm64, aix-ppc64, solaris-amd64] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Go | |
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version: 'stable' | |
- name: Set target platform | |
run: | | |
{ | |
echo "GOOS=$(echo ${{ matrix.target }} | cut -d - -f1)" | |
echo "GOARCH=$(echo ${{ matrix.target }} | cut -d - -f2)" | |
} >> "$GITHUB_ENV" | |
- name: Run Linter | |
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 |