[workflows]: Specify PYTHONPATH explicitly
This commit is contained in:
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
@ -4,6 +4,9 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@ -28,16 +31,30 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r server/src/requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
# Run tests with coverage
|
# Run tests and generate coverage report
|
||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: PYTHONPATH=$(pwd)/src pytest --cov=src/functions --cov-report=html
|
run: |
|
||||||
#
|
export PYTHONPATH=$(pwd)/server/src # Fix: Set PYTHONPATH
|
||||||
|
pytest --cov=src/functions --cov-report=term-missing --cov-report=xml --cov-report=html
|
||||||
|
|
||||||
# Upload coverage report as an artifact
|
# Upload coverage report as an artifact
|
||||||
- name: Upload coverage report (HTML)
|
- name: Upload coverage report (HTML)
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: coverage-report-html
|
name: coverage-report-html
|
||||||
path: htmlcov/
|
path: htmlcov/
|
||||||
|
|
||||||
|
# Upload XML coverage report for CI tools
|
||||||
|
- name: Upload coverage report (XML)
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: coverage-report-xml
|
||||||
|
path: coverage.xml
|
||||||
|
|
||||||
|
# Show coverage summary in logs
|
||||||
|
- name: Show coverage summary
|
||||||
|
run: cat coverage.xml
|
||||||
|
Reference in New Issue
Block a user