Skip to content

Commit

Permalink
Add pact-broker container to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
austek committed Jan 12, 2025
1 parent 3ddfc98 commit 651e15a
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,6 @@ env:
jobs:
build:
name: Build and Test
container:
image: pactfoundation/pact-broker
ports:
- 9292
env:
PACT_BROKER_PORT: '9292'
PACT_BROKER_DATABASE_URL: "postgres://postgres:password@postgres/postgres"
PACT_BROKER_LOG_LEVEL: INFO
PACT_BROKER_SQL_LOG_LEVEL: DEBUG
# PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES is only needed for docker-compose
# because the database takes longer to start up than the puma process
# Should not be needed in production.
PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "5"
# The list of allowed base URLs (not setting this makes the app vulnerable to cache poisoning)
# This list allows the app to be addressed from the host and from within another docker container correctly
# Ngnix config below makes the app accessible on ports 443 and 80, while the Ruby application itself runs on port 9292
PACT_BROKER_BASE_URL: 'https://localhost http://localhost http://localhost:9292 http://pact-broker:9292 https://host.docker.internal http://host.docker.internal http://host.docker.internal:9292'
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -93,6 +69,9 @@ jobs:
shell: bash
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck

- name: Start containers
run: docker compose -f docker-compose.yml up -d

- name: Set outputs
id: vars
shell: bash
Expand Down Expand Up @@ -127,6 +106,10 @@ jobs:
shell: bash
run: sbt '++ ${{ matrix.scala }}' provider/test

- name: Stop containers
if: always()
run: docker compose -f docker-compose.yml down

- name: Compress target directories
shell: bash
run: tar cf targets.tar target modules/plugin/target modules/examples/provider/target modules/examples/consumer/target project/target
Expand Down

0 comments on commit 651e15a

Please sign in to comment.