feat: integrate keploy for ci-cd #2
This file contains hidden or 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: Keploy E2E on PR | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: keploy-e2e-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| keploy-e2e: | |
| name: Install Keploy, build, and run tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Show Docker and Compose versions | |
| run: | | |
| docker --version | |
| docker compose version | |
| - name: Install Keploy CLI | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| curl --silent -O -L https://keploy.io/install.sh | |
| # Source in current shell so the script can modify PATH for this step if needed | |
| source install.sh | |
| # Verify installation | |
| command -v keploy | |
| keploy version || true | |
| - name: Build Docker images (compose) | |
| run: | | |
| docker compose build --pull | |
| - name: Run Keploy tests against docker compose | |
| env: | |
| # Increase Docker's default logs size to keep useful output (optional) | |
| COMPOSE_HTTP_TIMEOUT: "200" | |
| run: | | |
| # Run keploy with the provided command and options | |
| keploy test -c "docker compose up" \ | |
| --container-name="user_service" \ | |
| --path="./user_service" \ | |
| --config-path="./user_service" \ | |
| --delay 15 \ | |
| -t test-set-0 | |
| - name: Upload Keploy artifacts (user_service) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: keploy-user_service-artifacts | |
| path: | | |
| user_service/keploy/** | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| - name: Upload service coverage (optional) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: service-coverage | |
| path: | | |
| coverage/** | |
| apigateway/coverage/** | |
| user_service/coverage/** | |
| product_service/coverage/** | |
| order_service/coverage/** | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| - name: Teardown docker compose | |
| if: always() | |
| run: | | |
| docker compose ps | |
| docker compose logs --no-color | tail -n 200 || true | |
| docker compose down -v --remove-orphans |