Skip to content

Added files pylint, integration tests, CI, workflow #617

Added files pylint, integration tests, CI, workflow

Added files pylint, integration tests, CI, workflow #617

name: Integration Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
shared:
uses: ./.github/workflows/shared_workflow.yml
with:
python-version: "3.x"
env-vars: |

Check failure on line 16 in .github/workflows/integration-tests.yml

View workflow run for this annotation

GitHub Actions / Integration Tests

Invalid workflow file

The workflow is not valid. .github/workflows/integration-tests.yml (Line: 16, Col: 17): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DB_PORT
DB_PORT=${{ secrets.DB_PORT }}
DB_NAME=${{ secrets.DB_NAME }}
DB_USER=${{ secrets.DB_USER }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
DB_HOST=${{ secrets.DB_HOST }}
STARKNET_NODE_URL=${{ secrets.STARKNET_NODE_URL }}
REDIS_HOST=${{ secrets.REDIS_HOST }}
REDIS_PORT=${{ secrets.REDIS_PORT }}
ENV_VERSION=${{ secrets.ENV_VERSION }}
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build and Start Containers
run: |
docker compose -f docker-compose.dev.yaml up -d --build
echo "Waiting for containers to be ready..."
sleep 30
- name: Install Test Dependencies in Container
run: |
docker exec backend_dev pip install pytest pytest-cov
docker exec backend_dev pip freeze # Debug: show installed packages
- name: Wait for Backend Service
timeout-minutes: 5
run: |
while ! curl -s http://localhost:8000/health > /dev/null; do
echo "Waiting for backend service..."
sleep 30
# Check if the container is still running before logging
if ! docker ps | grep -q backend; then
echo "Backend container is not running!"
docker compose -f docker-compose.dev.yaml logs backend || true
exit 1
fi
# Log the backend service status for debugging purposes.
docker compose -f docker-compose.dev.yaml logs backend || true
done
- name: Apply Migrations
run: |
docker exec backend_dev alembic -c web_app/alembic.ini upgrade head || {
echo "Migration failed. Showing backend logs:"
docker compose -f docker-compose.dev.yaml logs backend || true
exit 1
}
- name: Run Integration Tests with Coverage
run: |
docker compose exec backend bash -c "cd /app && python -m pytest web_app/test_integration/ -v"
- name: Clean Up
if: always()
run: |
docker compose -f docker-compose.dev.yaml logs > docker-logs.txt || true
docker compose -f docker-compose.dev.yaml down -v
- name: Upload Docker Logs on Failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: docker-logs
path: docker-logs.txt