Setup Tests for Monorepo #28
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: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r api/requirements.txt | |
- name: Run backend tests | |
run: | | |
export PYTHONPATH=$(pwd) | |
pytest --cov=api api/tests/ --cov-report=xml | |
- name: Upload backend coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
flags: backend | |
- name: Upload backend coverage to Codecov via CLI | |
run: | | |
curl -Os https://cli.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov --verbose upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n 'backend-job'-${{ github.run_id }} -F backend -f coverage.xml | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Install frontend dependencies | |
run: npm install | |
- name: Run frontend tests | |
run: npm run test | |
- name: Upload frontend coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: frontend |