CI: SVC BGS API integration test #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'CI: SVC BGS API integration test' | |
on: | |
# Allow manual triggering | |
workflow_dispatch: | |
# Allow being called by another GitHub Action | |
workflow_call: | |
env: | |
COMPOSE_PROFILES: 'bgs' | |
jobs: | |
integration-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Setup Ruby' | |
uses: ruby/setup-ruby@v1.165.1 | |
with: | |
ruby-version: '3.3.0' | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Build the images' | |
uses: ./.github/actions/build-images | |
- name: 'Start the containers' | |
run: | | |
source scripts/setenv.sh | |
# create basic auth token for RabbitMQ and export to github environment | |
BASIC_AUTH=$(echo "${RABBITMQ_USERNAME}:${RABBITMQ_PASSWORD}" | base64) | |
{ | |
echo "RABBITMQ_USERNAME=${RABBITMQ_USERNAME}" | |
echo "RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}" | |
echo "RABBITMQ_BASIC_AUTH=${BASIC_AUTH}" | |
} >> "$GITHUB_ENV" | |
export -p | sed 's/declare -x //' | |
./gradlew :dockerComposeUp | |
./gradlew :app:dockerComposeUp | |
- name: 'Wait for containers to start' | |
run: sleep 60s | |
shell: bash | |
- name: 'Check disk space (Post-Build)' | |
uses: ./.github/actions/check-disk-space | |
- name: 'Check for RabbitMQ to be ready' | |
uses: Ponnia-M/curl@v1.0.0 | |
with: | |
url: 'http://localhost:15672/api/vhosts' | |
method: 'GET' | |
basic-auth-token: '${{env.RABBITMQ_BASIC_AUTH}}' | |
accept: 200 | |
# Retry every 2 seconds | |
timeout: 2000 | |
# Quit after 60 seconds | |
retries: 30 | |
- name: 'Check for healthy BGS container' | |
run: timeout 60s sh -c 'until docker ps | grep ".*svc-bgs-api.*" | grep -q healthy; do echo "Waiting for container to be healthy..."; sleep 2; done' | |
- name: 'Run integration tests' | |
run: | | |
./gradlew :svc-bgs-api:bundleInstall | |
./gradlew :svc-bgs-api:integrationTest | |
- name: 'Clean shutdown of all containers' | |
if: always() | |
shell: bash | |
run: | | |
docker ps | |
COMPOSE_PROFILES="all" ./gradlew dockerComposeDown |