Skip to content

Update moq installation to version 0.5.0 in README and workflow #4

Update moq installation to version 0.5.0 in README and workflow

Update moq installation to version 0.5.0 in README and workflow #4

name: Agent Manager API PR Checks
on:
push:
branches: ["main"]
paths:
- "agent-manager-service/**"
- ".github/workflows/agent-manager-service-pr-checks.yml"
pull_request:
branches: ["main"]
paths:
- "agent-manager-service/**"
- ".github/workflows/agent-manager-service-pr-checks.yml"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
working-directory: agent-manager-service
args: --config .github/linters/.golangci.yaml
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: agentmanager
POSTGRES_PASSWORD: agentmanager
POSTGRES_DB: agentmanager
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Create test .env file
working-directory: ./agent-manager-service
run: |
cat > .env << 'EOF'
DB_HOST=localhost
DB_PORT=5432
DB_USER=agentmanager
DB_PASSWORD=agentmanager
DB_NAME=agentmanager
SERVER_PORT=8080
EOF
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U agentmanager; do
echo "Waiting for postgres..."
sleep 1
done
timeout-minutes: 2
- name: Run tests
working-directory: ./agent-manager-service
run: make test
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Build
working-directory: ./agent-manager-service
run: go build -v ./...
codegen-format:
name: Code Generation & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Install wire
run: go install github.com/google/wire/cmd/wire@latest
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Install moq
run: go install github.com/matryer/moq@v0.5.0
- name: Run wire code generation
working-directory: ./agent-manager-service
run: make wire
- name: Run go generate
working-directory: ./agent-manager-service
run: make codegen
- name: Run formatting
working-directory: ./agent-manager-service
run: make fmt
- name: Run go mod tidy
working-directory: ./agent-manager-service
run: go mod tidy
- name: Check for uncommitted changes
working-directory: ./agent-manager-service
run: |
if [ ! -z "$(git status --porcelain)" ]; then
echo "Code generation or formatting produced changes:"
git diff
git status
echo ""
echo "Please run 'make codegenfmt-check' locally and commit the changes."
exit 1
fi