Skip to content

Add unit tests for items #46

Add unit tests for items

Add unit tests for items #46

Workflow file for this run

name: CI Pipeline
on:
push:
paths-ignore:
- '**/*'
- 'ansible/**'
- '**/*.md'
env:
PYTHON_VERSION: 3.11
POETRY_VERSION: 1.7.1
FLAKE_CC_MAX_THRESHOLD: 10
jobs:
lint-complexity:
name: Lint & Complexity Check
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install Dependencies
run: poetry install
- name: Run flake8 Complexity
run: poetry run flake8 --select=C --max-complexity=${{ env.FLAKE_CC_MAX_THRESHOLD }} bin/ internal/ tests/
- name: Run flake8 Lint
run: poetry run flake8 bin/ internal/ tests/
security:
name: Security Check
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
# - uses: abatilo/actions-poetry@v3
# with:
# poetry-version: ${{ env.POETRY_VERSION }}
# - name: Install Dependencies
run: poetry install
- name: Run bandit
run: poetry run bandit -c pyproject.toml -r bin/ internal/ tests/
test:
name: Test
runs-on: ubuntu-22.04
timeout-minutes: 10
needs:
- lint-complexity
- security
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install Dependencies
run: poetry install
- name: Run pytest with coverage
run: >
poetry run pytest \
--junitxml=reports/test-report.xml \
--html=reports/report.html \
--cov-report=term-missing \
--cov=internal \
--cov-fail-under=60 tests/
- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: test-report
path: ./reports/