Skip to content

feat: add integration test infrastructure with E2E SMS tests #2

feat: add integration test infrastructure with E2E SMS tests

feat: add integration test infrastructure with E2E SMS tests #2

Workflow file for this run

name: api
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: latest
- name: Generate Firebase credentials
run: |
bash tests/generate-firebase-credentials.sh tests/firebase-credentials.json
echo "FIREBASE_CREDENTIALS=$(jq -c . tests/firebase-credentials.json)" >> $GITHUB_ENV
- name: Start Services
working-directory: ./tests
run: docker compose up -d --build
- name: Wait for services to be healthy
working-directory: ./tests
run: |
echo "Waiting for API to be healthy..."
for i in $(seq 1 40); do
if docker compose exec api curl -sf http://localhost:8000/health >/dev/null 2>&1; then
echo "API is healthy!"
break
fi
if [ $i -eq 40 ]; then
echo "API failed to become healthy"
docker compose logs api
exit 1
fi
echo "Attempt $i/40 - waiting 5s..."
sleep 5
done
- name: Seed Database
working-directory: ./tests
run: |
echo "Waiting for seed container to finish..."
docker compose wait seed || true
sleep 2
- name: Run Integration Tests
working-directory: ./tests
run: go test -v -timeout 300s ./...
- name: Collect Logs on Failure
if: failure()
working-directory: ./tests
run: |
docker compose logs --tail 200
- name: Stop Services
if: always()
working-directory: ./tests
run: docker compose down -v