Skip to content

CICD

CICD #8

Workflow file for this run

name: Keploy API Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
run-keploy-tests:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:4.4
options: >-
--health-cmd="mongo --eval 'db.runCommand({ ping: 1 })'"
--health-interval=10s --health-timeout=5s --health-retries=5
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Set up environment
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- name: Wait for MongoDB to be ready
run: |
for i in {1..10}; do
nc -z localhost 27017 && echo "✅ MongoDB is ready" && break
echo "⏳ Waiting for MongoDB..."
sleep 5
done
- name: Download Keploy CLI
run: |
curl -fsSL https://github.com/keploy/keploy/releases/latest/download/keploy-linux-amd64 -o keploy
chmod +x keploy
file keploy
./keploy version
sudo mv keploy /usr/local/bin/keploy
- name: Run Keploy in test mode
env:
KEPLOY_MODE: test
run: |
keploy test -c "python flask_api_server.py" --delay 10