fix: resolve govet shadow variable errors (PR #28 followup) #160
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: "v2.11.3" | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: mesh | |
| POSTGRES_PASSWORD: mesh | |
| POSTGRES_DB: mesh | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U mesh" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| nats: | |
| image: nats:2-alpine | |
| ports: | |
| - 4222:4222 | |
| # Note: JetStream enabled via command args | |
| # GitHub Actions services don't support 'command', | |
| # so we'll configure NATS connection to work without JetStream in unit tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install goose | |
| run: go install github.com/pressly/goose/v3/cmd/goose@latest | |
| - name: Run migrations | |
| env: | |
| GOOSE_DRIVER: postgres | |
| GOOSE_DBSTRING: "postgres://mesh:mesh@localhost:5432/mesh?sslmode=disable" | |
| run: goose -dir migrations up | |
| - name: Run tests | |
| env: | |
| DATABASE_URL: "postgres://mesh:mesh@localhost:5432/mesh?sslmode=disable" | |
| REDIS_URL: "redis://localhost:6379" | |
| NATS_URL: "nats://localhost:4222" | |
| run: go test ./... -v -race -coverprofile=coverage.out -covermode=atomic | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.out | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build API server | |
| run: go build -o bin/api ./cmd/api | |
| - name: Build MCP server | |
| run: go build -o bin/mcp ./cmd/mcp | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries | |
| path: bin/ |