Skip to content

Commit 232cd13

Browse files
authored
Merge branch 'dev' into refactor/tests-compliance
Signed-off-by: Hugo Costa <[email protected]>
2 parents 4ca7649 + 69deb3b commit 232cd13

File tree

8 files changed

+894
-28
lines changed

8 files changed

+894
-28
lines changed

.github/workflows/dev-ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI-dev-pipeline
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- dev
7+
paths-ignore:
8+
- "scripts/**"
9+
- "BlocksScreen/lib/ui/**"
10+
- "extras/**"
11+
jobs:
12+
ci-checks:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.11.2"]
18+
test-type: [ruff, pylint, pytest, docstrcov, security]
19+
20+
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: pip
29+
cache-dependency-path: scripts/requirements-dev.txt
30+
31+
- name: Install dependencies
32+
run: |
33+
echo "Installing dependencies"
34+
python -m pip install --upgrade pip
35+
pip install -r scripts/requirements-dev.txt
36+
37+
- name: Run Test ${{ matrix.test-type }}
38+
run: |
39+
echo "Starting test runs"
40+
if [ "${{ matrix.test-type }}" == "ruff" ]; then
41+
echo "Running Formatting Test"
42+
ruff check --output-format=github --target-version=py311 --config=pyproject.toml > ruff-output.txt 2>&1
43+
ruff format --diff --target-version=py311 --config=pyproject.toml >> ruff-output.txt 2>&1
44+
echo "Ruff finished"
45+
fi
46+
if [ "${{ matrix.test-type }}" == "pylint" ]; then
47+
echo "Running Pylint Code Test"
48+
pylint -j$(nproc) --recursive=y BlocksScreen/ > pylint-output.txt 2>&1
49+
echo "Pylint finished"
50+
fi
51+
52+
if [ "${{ matrix.test-type }}" == "pytest" ]; then
53+
if [ -d "tests/" ] && [ "$(ls -A tests/)" ]; then
54+
echo "Running Python unit tests"
55+
pytest tests/ --doctest-modules --junitxml=junit/test-results.xml --cov=BlocksScreen/ --cov-report=xml --cov-report=html > pytest-output.txt 2>&1
56+
else
57+
echo "No tests directory no need to proceed with tests"
58+
fi
59+
fi
60+
61+
if [ "${{ matrix.test-type }}" == "docstrcov" ]; then
62+
echo "Running docstring coverage test"
63+
docstr-coverage BlocksScreen/ --exclude '.*/BlocksScreen/lib/ui/.*?$' --fail-under=80 --skip-magic --skip-init --skip-private --skip-property > docstr-cov-output.txt 2>&1
64+
fi
65+
66+
if [ "${{matrix.test-type }}" == "security" ]; then
67+
echo "Running bandit security test"
68+
bandit -c pyproject.toml -r . -f json -o bandit-output.json 2>&1
69+
fi
70+
71+
- name: Upload ruff artifact
72+
if: always() && matrix.test-type == 'ruff'
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: ruff-results
76+
path: ruff-output.txt
77+
78+
- name: Upload Pylint Artifacts
79+
if: always() && matrix.test-type == 'pylint'
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: pylint-results
83+
path: pylint-output.txt
84+
85+
- name: Upload Pytest Artifacts
86+
if: always() && matrix.test-type == 'pytest'
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: pytest-results
90+
path: |
91+
pytest-output.txt
92+
junit/test-results.xml
93+
coverage.xml
94+
htmlcov/
95+
continue-on-error: true
96+
97+
- name: Upload docstr coverage report
98+
if: always() && matrix.test-type == 'docstrcov'
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: docstr-coverage
102+
path: docstr-cov-output.txt
103+
104+
- name: Upload bandit security report
105+
if: always() && matrix.test-type == 'security'
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: bandit-output
109+
path: bandit-output.json

.github/workflows/stage-ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: stage-ci
2+
3+
on:
4+
branches:
5+
- stage
6+
paths-ignore:
7+
- "scripts/**"
8+
- "BlocksScreen/lib/ui/**"
9+
- "extras/**"
10+
workflow_run:
11+
workflows: ["dev-test-code"]
12+
types:
13+
- completed
14+
jobs:
15+
ci-stage:
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@v4
21+
22+
- name: Run staging pipeline
23+
run: echo "Running staging integration tests..."

.pylintrc.dev

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[MAIN]
2+
fail-under=7
3+
jobs=16
4+
ignore=tests,scripts,ui,extras
5+
ignore-paths=BlocksScreen/lib/ui
6+
py-version=3.11
7+
8+
9+
[FORMAT]
10+
max-line-length=88
11+

pyproject.toml

Lines changed: 75 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,96 @@ description = "GUI for BLOCKS Printers running Klipper"
55
authors = [
66
{ name = "Hugo do Carmo Costa", email = "[email protected]" },
77
]
8+
maintainers = [
9+
{ name = "Guilherme Costa", email = "[email protected]" },
10+
{ name = "Roberto Martins ", email = "[email protected]" },
11+
]
812
dependencies = [
913
'altgraph==0.17.4',
10-
'certifi==2024.7.4',
11-
'charset-normalizer==3.3.2',
12-
'idna==3.8',
13-
'numpy==2.1.0',
14-
'pefile==2023.2.7',
15-
'PyQt6==6.7.1',
16-
'PyQt6-Qt6==6.7.2',
17-
'PyQt6_sip==13.8.0',
18-
'requests==2.32.3',
19-
'sdbus==0.12.0',
14+
'certifi==2025.10.5',
15+
'charset-normalizer==3.4.4',
16+
'idna==3.11',
17+
'numpy==2.3.4',
18+
'pefile==2024.8.26',
19+
'PyQt6==6.10.0',
20+
'PyQt6-Qt6==6.10.0',
21+
'PyQt6_sip==13.10.2',
22+
'requests>=2.32.5',
23+
'sdbus==0.14.1',
2024
'sdbus-networkmanager==2.0.0',
2125
'typing==3.7.4.3',
22-
'websocket-client==1.8.0',
23-
'opencv-python-headless==4.11.0.86',
24-
'qrcode==8.2'
26+
'websocket-client==1.9.0',
27+
'qrcode==8.2',
2528
]
26-
requires-python = ">=3.11.2"
29+
requires-python = "==3.11.2"
2730
readme = "README.md"
2831
license = { text = "GNU Affero General Public License v3.0 or later" }
2932
keywords = ["GUI", "klipper", "BlocksScreen", "BLOCKS"]
3033

34+
[project.optional-dependencies]
35+
dev = ["ruff", "pylint", "pytest", "pytest-cov", "docstr_coverage"]
36+
stage = ["bandit"]
37+
full-dev = ["BlockScreen[dev,stage]"]
38+
39+
40+
[project.urls]
41+
Homepage = "https://blockstec.com"
42+
Issues = "https://github.com/BlocksTechnology/BlocksScreen/issues"
43+
3144
[tool.ruff]
3245
line-length = 88
3346
indent-width = 4
47+
exclude = [
48+
".bzr",
49+
".direnv",
50+
".eggs",
51+
".git",
52+
".git-rewrite",
53+
".hg",
54+
".ipynb_checkpoints",
55+
".mypy_cache",
56+
".nox",
57+
".pants.d",
58+
".pyenv",
59+
".pytest_cache",
60+
".pytype",
61+
".ruff_cache",
62+
".svn",
63+
".tox",
64+
".venv",
65+
".vscode",
66+
"__pypackages__",
67+
"_build",
68+
"buck-out",
69+
"build",
70+
"dist",
71+
"node_modules",
72+
"site-packages",
73+
"venv",
74+
"BlocksScreen/lib/ui",
75+
"extras",
76+
"tests"
77+
]
78+
79+
[tool.ruff.lint]
80+
ignore = ["F403"]
3481

3582
[tool.ruff.format]
3683
indent-style = "space"
3784
line-ending = 'auto'
3885
docstring-code-format = true
3986
docstring-code-line-length = 94
87+
88+
[tool.pylint]
89+
fail-under = 7
90+
jobs = 16
91+
ignore = ["tests", "scripts", "ui", "extras"]
92+
ignore-paths = ["BlocksScreen/lib/ui"]
93+
py-version = "3.11"
94+
max-line-length = 88
95+
96+
[tool.pytest.ini_options]
97+
addopts = "--cov=BlocksScreen --cov-report=html"
98+
99+
[tool.bandit]
100+
exclude_dirs = ["tests", "BlocksScreen/lib/ui/resources/"]

scripts/dev-requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

scripts/requirements-dev.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ruff
2+
pylint
3+
pytest
4+
pytest-cov
5+
docstr_coverage
6+
bandit

scripts/requirements.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
altgraph==0.17.4
2-
certifi==2024.7.4
3-
charset-normalizer==3.3.2
4-
idna==3.8
5-
numpy==2.1.0
6-
pefile==2023.2.7
7-
PyQt6==6.7.1
8-
PyQt6-Qt6==6.7.2
9-
PyQt6_sip==13.8.0
10-
requests==2.32.4
11-
sdbus==0.12.0
2+
certifi==2025.10.5
3+
charset-normalizer==3.4.4
4+
idna==3.11
5+
numpy==2.3.4
6+
pefile==2024.8.26
7+
PyQt6==6.10.0
8+
PyQt6-Qt6==6.10.0
9+
PyQt6_sip==13.10.2
10+
requests>=2.32.5
11+
sdbus==0.14.1
1212
sdbus-networkmanager==2.0.0
1313
typing==3.7.4.3
14-
websocket-client==1.8.0
15-
opencv-python-headless==4.11.0.86
14+
websocket-client==1.9.0
1615
qrcode==8.2

0 commit comments

Comments
 (0)