|
1 | | -name: Unit Tests |
| 1 | +name: CI – Unit Tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | 4 | push: |
6 | | - branches: ['**'] |
| 5 | + pull_request: |
7 | 6 |
|
8 | 7 | jobs: |
9 | | - test-js-py: |
| 8 | + client-tests: |
| 9 | + name: Client (React) Tests |
10 | 10 | runs-on: ubuntu-latest |
11 | | - |
12 | | - strategy: |
13 | | - matrix: |
14 | | - node: [18, 20] |
15 | | - python: ['3.10', '3.11'] |
16 | | - |
17 | 11 | steps: |
18 | 12 | - uses: actions/checkout@v4 |
19 | | - |
20 | | - # ───────────── JavaScript side ───────────── |
21 | | - - name: Set up Node |
22 | | - uses: actions/setup-node@v4 |
| 13 | + - uses: actions/setup-node@v4 |
23 | 14 | with: |
24 | | - node-version: ${{ matrix.node }} |
25 | | - # ⚠️ no cache line → setup-node won’t look for package-lock.json |
26 | | - # cache: 'npm' |
27 | | - |
28 | | - - name: Install JS deps |
| 15 | + node-version: '18' |
| 16 | + - name: Install & Test Client |
| 17 | + working-directory: client |
29 | 18 | run: | |
30 | | - if [ -f package-lock.json ]; then |
31 | | - echo "package-lock.json found → npm ci" |
32 | | - npm ci |
33 | | - else |
34 | | - echo "No lock-file → npm install" |
35 | | - npm install |
36 | | - fi |
| 19 | + npm ci |
| 20 | + npm test -- --ci || echo "No client tests" |
37 | 21 |
|
38 | | - - name: Run JS unit tests (if any) |
39 | | - run: npm test -- --ci || echo "No JS tests" |
40 | | - |
41 | | - # ───────────── Python side ───────────── |
42 | | - - name: Set up Python |
43 | | - uses: actions/setup-python@v5 |
| 22 | + python-tests: |
| 23 | + name: Python Tests |
| 24 | + runs-on: ubuntu-latest |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + python-version: ['3.10', '3.11'] |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - uses: actions/setup-python@v5 |
44 | 31 | with: |
45 | | - python-version: ${{ matrix.python }} |
46 | | - cache: 'pip' |
47 | | - |
48 | | - - name: Install Python deps & run tests |
49 | | - run: | |
50 | | - pip install -r backend/requirements.txt |
51 | | - pip install pytest |
52 | | - pytest backend || echo "No Py tests" |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + cache: pip |
| 34 | + - name: Install Dependencies |
| 35 | + run: pip install -r requirements.txt |
| 36 | + - name: Run pytest |
| 37 | + run: pytest tests || echo "No Python tests" |
0 commit comments