Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: dev-test-code

on:
push:
branches:
- dev
paths-ignore:
- "scripts/**"
- "BlocksScreen/lib/ui/**"
- "extras/**"
pull_request:
branches:
- dev
paths-ignore:
- "scripts/**"
- "BlocksScreen/lib/ui/**"
- "extras/**"
jobs:
ci-checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11.2"]
test-type: [ruff, pylint, pytest]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
echo "Installing dependencies"
python -m pip install --upgrade pip
pip install scripts -r scripts/requirements-dev.txt

- name: Run Test ${{ matrix.test-type }}
run: |
echo "Starting test runs"
if [ "${{ matrix.test-type }}" == "ruff" ]; then
echo "Running Formatting Test"
ruff check --output-format=github --target-version=py311 --config=pyproject.toml > ruff-output.txt 2>&1
ruff format --diff --target-version=py311 --config=pyproject.toml >> ruff-output.txt 2>&1
echo "Ruff finished"
fi
if [ "${{ matrix.test-type }}" == "pylint" ]; then
echo "Running Code Test"
pylint -j$(nproc) --recursive=y --rcfile=.pylintrc.dev . > pylint-output.txt 2>&1
echo "Pylint finished"
fi

if [ "${{ matrix.test-type }}" == "pytest" ]; then
if [ -d "tests/" ] && [ "$(ls -A tests/)" ]; then
echo "Running Python unit tests"
pytest tests/'*.py' --doctest-modules --junitxml=junit/test-results.xml --cov=com --conv-report=xml --cov-report=html > pytest-output.txt 2>&1
else
echo "No tests directory no need to proceed with tests"
fi
fi

- name: Upload ruff artifact
if: always() && matrix.test-type == 'ruff'
uses: actions/upload-artifact@v4
with:
name: ruff-results
path: ruff-output.txt

- name: Upload Pylint Artifacts
if: always() && matrix.test-type == 'pylint'
uses: actions/upload-artifact@v4
with:
name: pylint-results
path: pylint-output.txt

- name: Upload Pytest Artifacts
if: always() && matrix.test-type == 'pytest' && hashFiles('pytest-output.txt', 'junit/test-results.xml', 'coverage.xml')
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: |
pytest_output.txt
junit/test-results.xml
coverage.xml
htmlcov/

11 changes: 11 additions & 0 deletions .pylintrc.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[MAIN]
fail-under=7
jobs=16
ignore=tests,scripts,ui,extras
ignore-paths=BlocksScreen/lib/ui
py-version=3.11


[FORMAT]
max-line-length=88

2 changes: 0 additions & 2 deletions scripts/dev-requirements.txt

This file was deleted.

4 changes: 4 additions & 0 deletions scripts/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ruff
pylint
pytest
pytest-cov
Loading