69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
name: Python Test
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
paths:
|
|
- 'src/**'
|
|
- 'tests/**'
|
|
- '.github/workflows/pytest.yml'
|
|
- 'requirements.txt'
|
|
- 'requirements-dev.txt'
|
|
jobs:
|
|
python-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
id: installDependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Run Python Test
|
|
id: runPyTest
|
|
run: |
|
|
pytest --junitxml=pytest.xml --cov-report term-missing --cov=src tests/ | tee pytest-coverage.txt
|
|
|
|
- name: Coverage Report
|
|
id: CoverageReport
|
|
run: |
|
|
coverage-badge -o coverage.svg
|
|
python - <<EOF
|
|
from scripts.generate_coverage import GenerateCoverage
|
|
generate_coverage = GenerateCoverage()
|
|
generate_coverage.save_table()
|
|
EOF
|
|
|
|
- name: Update Readme
|
|
id: updateReadme
|
|
run: |
|
|
echo "# Pytest Report" > README.md
|
|
echo "" >> README.md
|
|
echo "" >> README.md
|
|
echo "" >> README.md
|
|
cat tests/table.md >> README.md
|
|
cat README.md
|
|
|
|
- name: Check files before upload
|
|
run: ls -l README.md coverage.svg
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ret-artifact
|
|
path: |
|
|
README.md
|
|
coverage.svg
|
|
|