-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (99 loc) · 3.39 KB
/
python-app-test.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# This workflow will install Python dependencies, run tests and
# lint with a single version of Python
# For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
permissions:
contents: read
jobs:
check-tests:
runs-on: ubuntu-latest
outputs:
tests_exist: ${{ steps.check.outputs.tests_exist }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check for test files
id: check
run: |
if find . -type f -name "*_test.py" | grep -q .; then
echo "::set-output name=tests_exist::true"
else
echo "::set-output name=tests_exist::false"
fi
run-tests:
runs-on: ubuntu-latest
needs: check-tests
if: needs.check-tests.outputs.tests_exist == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install NLTK and Download Resources
run: |
python -m pip install nltk
python -c "import nltk; nltk.download('stopwords')"
python -c "import nltk; nltk.download('punkt')"
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install poppler-utils
sudo apt-get install tesseract-ocr
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
ls -a
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
ls -a
cd backend/backend_tests
pytest --cov=. --cov-report=xml --cov-append
continue-on-error: true
- name: test gnd email monitor
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
ls -a
cd backend/GND_Email_Monitor
pytest --cov=. --cov-report=xml --cov-append
continue-on-error: true
- name: test document parser
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
ls -a
cd backend/Document_parser
pytest --cov=. --cov-report=xml --cov-append
continue-on-error: true
- name: Move Coverage Files to Root
run: |
mv backend/backend_tests/.coverage backend/.coverage.backend_tests
mv backend/GND_Email_Monitor/.coverage backend/.coverage.GND_Email_Monitor_tests
mv backend/Document_parser/.coverage backend/.coverage.Document_parser_tests
- name: Combine Coverage Reports
run: |
cd backend
coverage combine .coverage.*
coverage xml -o coverage.xml
- name: Integration test
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: |
ls -a
cd backend
python backend_entry_int_test.py
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
files: ./backend/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}