Skip to content

Merge branch 'main' into 16-unit-test-utils-2 #27

Merge branch 'main' into 16-unit-test-utils-2

Merge branch 'main' into 16-unit-test-utils-2 #27

Workflow file for this run

name: Python Application Testing
on: [push]
env:
PYTHON_VERSION: "3.8.15"
PROJECT_FOLDER: dcm_anon
TEST_FOLDER: tests
COVERAGE_LIMIT: 0
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry build
code-quality:
needs: build-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Security Analysis with bandit
run: |
mkdir ci-logs
poetry run bandit -r -lll -f txt -o ci-logs/bandit.log ${{env.PROJECT_FOLDER}} ${{env.TEST_FOLDER}}
- name: Archive bandit report
uses: actions/upload-artifact@v2
with:
name: bandit-report
path: ci-logs/bandit.log
code-coverage:
needs: code-quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry && poetry install
- name: Test with pytest
run: |
poetry install
poetry run pytest ${{env.TEST_FOLDER}} --cov-report=xml --cov=${{env.PROJECT_FOLDER}} --junitxml=./coverage.xml
- name: Code Coverage Summary Report
run: |
pip install coverage
coverage combine && coverage report --fail-under=${{env.COVERAGE_LIMIT}} -m
coverage html
- name: Archive code coverage html report
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: htmlcov/index.html