61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
name: Continuous Integration
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.13]
|
|
|
|
steps:
|
|
# Checkout the code
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
# Set up Python
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
# Install dependencies
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r server/src/requirements.txt
|
|
|
|
# Run tests and generate coverage report
|
|
- name: Run tests with coverage
|
|
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
|
|
- name: Upload coverage report (HTML)
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report-html
|
|
path: htmlcov/
|
|
|
|
# Upload XML coverage report for CI tools
|
|
- name: Upload coverage report (XML)
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report-xml
|
|
path: coverage.xml
|
|
|
|
# Show coverage summary in logs
|
|
- name: Show coverage summary
|
|
run: cat coverage.xml
|