Update workflow github actions #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Backend Unit Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
backend-unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Clear npm cache | |
run: | | |
npm cache clean --force | |
- name: Install dependencies | |
run: | | |
cd backend | |
npm install | |
- name: Run tests | |
run: | | |
cd backend | |
npm run test | |
- name: Display coverage directory contents | |
run: | | |
cd backend | |
ls -R coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./backend/coverage/*.json,./backend/coverage/lcov.info,./backend/coverage/clover.xml | |
flags: backend | |
fail_ci_if_error: true |