forked from se24ncsu/PopcornPicks
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.52 KB
/
codecoverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Code Coverage
on:
push:
branches: [project3]
pull_request:
branches: [project3]
jobs:
upload-coverage:
runs-on: ubuntu-latest
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
APP_PASSWORD: ${{ secrets.APP_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9 # Replace '3.x' with your desired Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pytest-mock coverage setuptools
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r ./backend/requirements.txt
sudo apt-get update
sudo apt-get install -y texlive-xetex texlive-fonts-extra
- name: Create env file
run: |
echo "CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}" > .env
echo "MONGO_URI=${{ secrets.MONGO_URI }}" >> .env
- name: Generate coverage
run: |
pytest -v --cov-config=.coveragerc --cov --cov-report=xml
python -c "import os;from pymongo import MongoClient; client = MongoClient(os.getenv('MONGO_URI')); client.testDB.movies.drop(); client.close()"
- name: Upload coverage reports to Codecov
if: always()
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}