feat: Add GitHub Actions workflow to run stack

This commit introduces a new GitHub Actions workflow (`.github/workflows/run_in_action.yml`).

The workflow allows for running the entire application stack (API, Redis, PostgreSQL) using Docker Compose directly within the GitHub Actions runner. This is intended for temporary testing or preview purposes.

Key features of the workflow:
- Triggers: Manually (`workflow_dispatch`) or on pull requests targeting `main` or `develop` branches.
- Services: Starts services defined in `docker-compose.yaml`.
- Health Check: Includes a step to wait for services to initialize and then pings the API's root endpoint (/) to verify it's responsive.
- Cleanup: Ensures `docker-compose down` is executed at the end of the run, even if previous steps fail, to clean up resources.
This commit is contained in:
google-labs-jules[bot] 2025-06-09 17:18:32 +00:00
parent 427c994993
commit c0ec4d5a3b

28
.github/workflows/run_in_action.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Run Application Stack in Action
on:
workflow_dispatch: # Allows manual triggering
pull_request:
branches: [ main, develop ] # Or specify branches as needed
jobs:
run_stack:
name: Run Docker Compose Stack
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Start Docker Compose Stack
run: docker-compose up -d
- name: Health Check
run: |
echo "Waiting for services to start..."
sleep 30 # Wait for 30 seconds
echo "Pinging API..."
curl -f http://localhost:8080/ | grep "Welcome to the Evolution API, it is working!"
- name: Stop Docker Compose Stack
if: always() # Ensures this step runs even if previous steps fail
run: docker-compose down