|
| 1 | +name: Test Pipeline |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test-cab_common: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - name: Checkout code |
| 10 | + uses: actions/checkout@v2 |
| 11 | + - name: Set up Python |
| 12 | + uses: actions/setup-python@v2 |
| 13 | + with: |
| 14 | + python-version: "3.11" |
| 15 | + - name: Install dependencies |
| 16 | + run: | |
| 17 | + cd backend/cab_common |
| 18 | + export PYTHONPATH=. |
| 19 | + pip install -r requirements.txt |
| 20 | + - name: Run tests |
| 21 | + run: | |
| 22 | + cd backend/cab_common |
| 23 | + pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml |
| 24 | + env: |
| 25 | + COV_CONTEXT: "backend/cab_common" |
| 26 | + |
| 27 | + test-event-service: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout code |
| 31 | + uses: actions/checkout@v2 |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@v2 |
| 34 | + with: |
| 35 | + python-version: "3.11" |
| 36 | + - name: Install dependencies |
| 37 | + run: | |
| 38 | + pip install backend/cab_common |
| 39 | + cd backend/event-service |
| 40 | + pip install -r requirements.txt |
| 41 | + - name: Run tests |
| 42 | + run: | |
| 43 | + cd backend/event-service |
| 44 | + export PYTHONPATH=. |
| 45 | + export FLASK_APP=web |
| 46 | + pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml |
| 47 | + env: |
| 48 | + COV_CONTEXT: "backend/event-service" |
| 49 | + |
| 50 | + test-context-service: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - name: Checkout code |
| 54 | + uses: actions/checkout@v2 |
| 55 | + - name: Set up Python |
| 56 | + uses: actions/setup-python@v2 |
| 57 | + with: |
| 58 | + python-version: "3.11" |
| 59 | + - name: Install dependencies |
| 60 | + run: | |
| 61 | + pip install backend/cab_common |
| 62 | + cd backend/context-service |
| 63 | + pip install -r requirements.txt |
| 64 | + pip install pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-runner==6.0.1 |
| 65 | + - name: Run tests |
| 66 | + run: | |
| 67 | + cd backend/context-service |
| 68 | + export PYTHONPATH=. |
| 69 | + export FLASK_APP=web |
| 70 | + pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml |
| 71 | + env: |
| 72 | + COV_CONTEXT: "backend/context-service" |
| 73 | + |
| 74 | + test-recommendation-service: |
| 75 | + runs-on: ubuntu-latest |
| 76 | + container: python:3.11.6-slim |
| 77 | + steps: |
| 78 | + - name: Checkout code |
| 79 | + uses: actions/checkout@v2 |
| 80 | + - name: Set up dependencies |
| 81 | + run: | |
| 82 | + mkdir -p /usr/share/man/man1 |
| 83 | + apt update && apt install -y --no-install-recommends default-jre |
| 84 | + pip install backend/cab_common |
| 85 | + - name: Set up recommendation service |
| 86 | + run: | |
| 87 | + cd backend/recommendation-service |
| 88 | + pip install -r requirements.txt |
| 89 | + pip install pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-runner==6.0.1 |
| 90 | + - name: Run tests |
| 91 | + run: | |
| 92 | + cd backend/recommendation-service |
| 93 | + export PYTHONPATH=. |
| 94 | + export FLASK_APP=web |
| 95 | + pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml |
| 96 | + env: |
| 97 | + COV_CONTEXT: "backend/recommendation-service" |
| 98 | + |
| 99 | + test-frontend-service: |
| 100 | + runs-on: ubuntu-latest |
| 101 | + container: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1 |
| 102 | + steps: |
| 103 | + - name: Checkout code |
| 104 | + uses: actions/checkout@v2 |
| 105 | + - name: Set up Node.js |
| 106 | + uses: actions/setup-node@v2 |
| 107 | + with: |
| 108 | + node-version: "16" |
| 109 | + - name: Install dependencies |
| 110 | + run: | |
| 111 | + cd frontend |
| 112 | + npm ci |
| 113 | + - name: Lint code |
| 114 | + run: | |
| 115 | + cd frontend |
| 116 | + npm run lint |
| 117 | + - name: Type-check code |
| 118 | + run: | |
| 119 | + cd frontend |
| 120 | + npm run type-check |
| 121 | + - name: Build project |
| 122 | + run: | |
| 123 | + cd frontend |
| 124 | + npm run build-only |
| 125 | + - name: Run tests |
| 126 | + run: | |
| 127 | + cd frontend |
| 128 | + npm run test:coverage |
| 129 | + - name: Upload coverage report |
| 130 | + if: always() |
| 131 | + uses: actions/upload-artifact@v3 |
| 132 | + with: |
| 133 | + name: frontend-coverage |
| 134 | + path: frontend/coverage |
| 135 | + env: |
| 136 | + COV_CONTEXT: "frontend" |
0 commit comments