CI – Integration Tests #38
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: Integration Tests | |
| on: | |
| pull_request: | |
| workflow_run: | |
| workflows: [Unit Tests] | |
| types: [completed] | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_PASSWORD: test | |
| ports: ['5432:5432'] | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # --- JavaScript side: Set up Node.js and run integration tests --- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - run: npm ci | |
| - name: Run JavaScript integration tests (using Jest or other) | |
| run: npm run test:integration || echo "No JS integration tests found" | |
| # --- Python side: Set up Python and run FastAPI integration tests --- | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| # Check if requirements.txt exists and only install if it does | |
| - name: Install Python dependencies (if requirements.txt exists) | |
| run: | | |
| if [ -f "backend/requirements.txt" ]; then | |
| echo "Found requirements.txt, installing dependencies..." | |
| pip install -r backend/requirements.txt | |
| else | |
| echo "No requirements.txt found, skipping pip install" | |
| fi | |
| - name: Start FastAPI backend (in the background) | |
| run: | | |
| uvicorn backend.app:app --host 0.0.0.0 --port 8000 & | |
| - name: Run Python integration tests | |
| run: pytest backend/integration_tests/ || echo "No Python integration tests found" |