From c0ec4d5a3b0cb9f096cdc0a541d0ce161380add0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:18:32 +0000 Subject: [PATCH] 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. --- .github/workflows/run_in_action.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/run_in_action.yml diff --git a/.github/workflows/run_in_action.yml b/.github/workflows/run_in_action.yml new file mode 100644 index 00000000..643d305c --- /dev/null +++ b/.github/workflows/run_in_action.yml @@ -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