name: Integration Tests on: push: branches: - main pull_request: branches: - main jobs: integration-test: runs-on: ubuntu-latest services: postgres: image: postgres:13 env: POSTGRES_DB: broker_test POSTGRES_USER: user POSTGRES_PASSWORD: password ports: # No fixed host port: Docker assigns a free one, avoiding # "port is already allocated" collisions with other jobs on a # shared runner. The assigned port is read below via the # `job.services.postgres.ports` context. - 5432/tcp options: >- --health-cmd="pg_isready -U user" --health-interval=5s --health-timeout=5s --health-retries=10 steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.25' cache: true - name: Run all tests env: TEST_DB_HOST: 127.0.0.1 TEST_DB_PORT: ${{ job.services.postgres.ports['5432'] }} run: make test-ci TEST_DB_HOST="$TEST_DB_HOST" TEST_DB_PORT="$TEST_DB_PORT"