60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
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
|
|
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.26'
|
|
cache: true
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
make fmt
|
|
git diff --exit-code -- '*.go'
|
|
|
|
- name: Install golangci-lint
|
|
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
|
|
|
|
- name: Run lint
|
|
run: make lint
|
|
|
|
- name: Run all tests
|
|
env:
|
|
# act_runner runs this job in its own container alongside the
|
|
# postgres service container, both on the job's Docker network.
|
|
# "localhost" from inside the job container is the job container
|
|
# itself, not the runner host, so the service must be reached by
|
|
# its network alias (the services: key) and container-internal
|
|
# port -- not a published host port.
|
|
TEST_DB_HOST: postgres
|
|
TEST_DB_PORT: 5432
|
|
run: make test-ci TEST_DB_HOST="$TEST_DB_HOST" TEST_DB_PORT="$TEST_DB_PORT"
|