|
1 | 1 | name: Integration Tests |
2 | 2 |
|
3 | | -on: |
4 | | - push: # Triggers on any push to any branch |
5 | | - pull_request: # Triggers on any pull request to any branch |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + workflow_run: |
| 6 | + workflows: [Unit Tests] |
| 7 | + types: [completed] |
6 | 8 |
|
7 | 9 | jobs: |
8 | | - integration-tests: |
9 | | - name: Run Integration Tests |
| 10 | + integration: |
10 | 11 | runs-on: ubuntu-latest |
| 12 | + services: |
| 13 | + postgres: |
| 14 | + image: postgres:15 |
| 15 | + env: |
| 16 | + POSTGRES_PASSWORD: test |
| 17 | + ports: ['5432:5432'] |
| 18 | + options: >- |
| 19 | + --health-cmd "pg_isready -U postgres" |
| 20 | + --health-interval 5s |
| 21 | + --health-timeout 5s |
| 22 | + --health-retries 5 |
11 | 23 |
|
12 | 24 | steps: |
13 | | - - name: Check out code |
14 | | - uses: actions/checkout@v3 |
15 | | - |
16 | | - # Set up Python environment if Python-based integration tests are required |
17 | | - - name: Set up Python |
18 | | - uses: actions/setup-python@v3 |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: actions/setup-node@v4 |
19 | 27 | with: |
20 | | - python-version: '3.x' |
21 | | - |
22 | | - - name: Install Python dependencies |
| 28 | + node-version: 20 |
| 29 | + - run: npm ci |
| 30 | + - name: Start backend (FastAPI) in background |
23 | 31 | run: | |
24 | | - python -m pip install --upgrade pip |
25 | | - pip install -r requirements.txt |
26 | | -
|
27 | | - # Set up Node.js environment if Node.js-based integration tests are required |
28 | | - - name: Set up Node.js |
29 | | - uses: actions/setup-node@v3 |
30 | | - with: |
31 | | - node-version: '16.x' |
32 | | - |
33 | | - - name: Install Node.js dependencies |
34 | | - run: npm install |
35 | | - |
36 | | - # Run Integration Tests |
37 | | - - name: Run Integration Tests |
38 | | - run: | |
39 | | - # Run Python integration tests if any (example command) |
40 | | - pytest tests/integration --junitxml=integration-test-results.xml || echo "No Python integration tests found." |
41 | | - |
42 | | - # Run Node.js integration tests if any (example command) |
43 | | - npm run test:integration || echo "No Node.js integration tests found." |
44 | | -
|
45 | | - # Optionally, upload integration test results |
46 | | - - name: Upload Test Results |
47 | | - uses: actions/upload-artifact@v3 |
48 | | - with: |
49 | | - name: integration-test-results |
50 | | - path: integration-test-results.xml # Adjust path based on output files |
| 32 | + pip install -r backend/requirements.txt |
| 33 | + uvicorn backend.app:app --host 0.0.0.0 --port 8000 & |
| 34 | + - name: Run integration tests |
| 35 | + run: npm run test:integration |
0 commit comments