|
7 | 7 | branches: [ "main" ] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - test-django: |
| 10 | + test: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 |
|
13 | 13 | steps: |
| 14 | + # Step 1: Check out the repository |
14 | 15 | - name: Check out the repository |
15 | 16 | uses: actions/checkout@v4 |
16 | 17 |
|
| 18 | + # Step 2: Set up Python for Django and pytest tests |
17 | 19 | - name: Set up Python |
18 | 20 | uses: actions/setup-python@v4 |
19 | 21 | with: |
20 | 22 | python-version: '3.9' |
21 | 23 |
|
22 | | - - name: Install dependencies |
| 24 | + # Step 3: Install Python dependencies |
| 25 | + - name: Install Python dependencies |
23 | 26 | run: | |
24 | 27 | python -m pip install --upgrade pip |
25 | 28 | pip install -r time_complexity_analyzer/requirements.txt |
26 | 29 |
|
27 | | - - name: Run migrations |
28 | | - run: python time_complexity_analyzer/manage.py migrate |
| 30 | + # Step 4: Run pytest for `analyzer` folder tests |
| 31 | + - name: Run pytest for analyzer tests |
| 32 | + run: pytest time_complexity_analyzer/analyzer |
29 | 33 |
|
30 | | - - name: Run tests |
31 | | - run: python time_complexity_analyzer/manage.py test |
| 34 | + # Step 5: Run Django migrations and tests |
| 35 | + - name: Run Django tests |
| 36 | + run: | |
| 37 | + python time_complexity_analyzer/manage.py migrate |
| 38 | + python time_complexity_analyzer/manage.py test |
| 39 | +
|
| 40 | + # Step 6: Set up Node.js for React frontend tests |
| 41 | + - name: Set up Node.js |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: '16' |
| 45 | + |
| 46 | + # Step 7: Install frontend dependencies |
| 47 | + - name: Install frontend dependencies |
| 48 | + working-directory: frontend |
| 49 | + run: npm install |
| 50 | + |
| 51 | + # Step 8: Run React frontend tests |
| 52 | + - name: Run React frontend tests |
| 53 | + working-directory: frontend |
| 54 | + run: npm test -- --watchAll=false |
0 commit comments