Skip to content

Refactor .golangci.yml for better formatting and settings #22

Refactor .golangci.yml for better formatting and settings

Refactor .golangci.yml for better formatting and settings #22

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: ["*"]
jobs:
check-go:
name: Check Go Project
runs-on: ubuntu-latest
outputs:
is-go-project: ${{ steps.check.outputs.exists }}
steps:
- uses: actions/checkout@v6
- id: check
run: |
if [ -f "go.mod" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "✓ go.mod found - proceeding with Go CI pipeline"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "⊘ go.mod not found - skipping Go CI pipeline"
fi
test:
name: Test
runs-on: ubuntu-latest
needs: check-go
if: needs.check-go.outputs.is-go-project == 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true
- run: go mod download
- run: go vet ./...
- run: go test -v -race -coverprofile=coverage.out ./...
lint:
name: Lint
runs-on: ubuntu-latest
needs: check-go
if: needs.check-go.outputs.is-go-project == 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true
- run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
- run: golangci-lint run
security:
name: Security
runs-on: ubuntu-latest
needs: check-go
if: needs.check-go.outputs.is-go-project == 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...
build:
name: Build
runs-on: ubuntu-latest
needs: check-go
if: needs.check-go.outputs.is-go-project == 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "stable"
check-latest: true
- run: go mod download
- run: go build ./...