|
| 1 | +name: Application unit tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ "main" ] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + unit-test-backend: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + env: |
| 14 | + SECRET_KEY: ${{ secrets.SECRET_KEY }} |
| 15 | + REFRESH_SECRET_KEY: ${{ secrets.REFRESH_SECRET_KEY }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - name: Set up Python 3.8 |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: "3.8" |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + pip install flake8 pytest |
| 26 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 27 | + - name: Lint with flake8 |
| 28 | + run: | |
| 29 | + # stop the build if there are Python syntax errors or undefined names |
| 30 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics \ |
| 31 | + --builtins=screen --per-file-ignore='specs/**/*:E9,F63,F7,F82' |
| 32 | +
|
| 33 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 34 | + flake8 . --count --show-source --exit-zero --max-complexity=10 \ |
| 35 | + --max-line-length=96 --statistics --per-file-ignore='specs/**/*:E9,F63,F7,F82' |
| 36 | + - name: Run pytest tests |
| 37 | + run: | |
| 38 | + chmod +x ./backend/scripts/test-coverage.sh |
| 39 | + cd backend && ./scripts/test-coverage.sh |
| 40 | +
|
| 41 | + unit-test-frontend: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Setup Node.js |
| 47 | + uses: actions/setup-node@v3 |
| 48 | + with: |
| 49 | + node-version: '20.x' |
| 50 | + |
| 51 | + - name: Test with Jest |
| 52 | + run: | |
| 53 | + cd frontend |
| 54 | + npm ci && npm run test:coverage |
| 55 | +
|
0 commit comments