1- name : dev-test-code
1+ name : CI- dev-pipeline
22
33on :
44 push :
55 branches :
6- - dev
6+ - dev
77 paths-ignore :
88 - " scripts/**"
99 - " BlocksScreen/lib/ui/**"
2222 fail-fast : false
2323 matrix :
2424 python-version : ["3.11.2"]
25- test-type : [ruff, pylint, pytest]
25+ test-type : [ruff, pylint, pytest, docstrcov, security]
26+ environment : Dev
27+
2628 steps :
2729 - name : Checkout repo
2830 uses : actions/checkout@v4
@@ -31,13 +33,15 @@ jobs:
3133 uses : actions/setup-python@v4
3234 with :
3335 python-version : ${{ matrix.python-version }}
34- cache : " pip"
36+ cache : pip
37+ cache-dependency-path : scripts/requirements-dev.txt
38+
3539 - name : Install dependencies
3640 run : |
3741 echo "Installing dependencies"
3842 python -m pip install --upgrade pip
39- pip install scripts -r scripts/requirements-dev.txt
40-
43+ pip install -r scripts/requirements-dev.txt
44+
4145 - name : Run Test ${{ matrix.test-type }}
4246 run : |
4347 echo "Starting test runs"
@@ -48,21 +52,32 @@ jobs:
4852 echo "Ruff finished"
4953 fi
5054 if [ "${{ matrix.test-type }}" == "pylint" ]; then
51- echo "Running Code Test"
52- pylint -j$(nproc) --recursive=y --rcfile=.pylintrc.dev . > pylint-output.txt 2>&1
55+ echo "Running Pylint Code Test"
56+ pylint -j$(nproc) --recursive=y BlocksScreen/ > pylint-output.txt 2>&1
5357 echo "Pylint finished"
5458 fi
5559
5660 if [ "${{ matrix.test-type }}" == "pytest" ]; then
5761 if [ -d "tests/" ] && [ "$(ls -A tests/)" ]; then
5862 echo "Running Python unit tests"
59- pytest tests/'*.py' --doctest-modules --junitxml=junit/test-results.xml --cov=com --conv -report=xml --cov-report=html > pytest-output.txt 2>&1
63+ pytest tests/ --doctest-modules --junitxml=junit/test-results.xml --cov=BlocksScreen/ --cov -report=xml --cov-report=html > pytest-output.txt 2>&1
6064 else
6165 echo "No tests directory no need to proceed with tests"
6266 fi
6367 fi
6468
65- - name : Upload ruff artifact
69+ if [ "${{ matrix.test-type }}" == "docstrcov" ]; then
70+ echo "Running docstring coverage test"
71+ docstr-coverage BlocksScreen/ --exclude .*/BlocksScreen/lib/ui/.*?$ --fail-under=80 --skip-magic --skip-init --skip-private --skip-property > docstr-cov-output.txt 2>&1
72+ fi
73+
74+ if [ "${{matrix.test-type }}" == "security" ]; then
75+ echo "Running bandit security test"
76+ bandit -c pyproject.toml -r . -f json -o bandit-output.json 2>&1
77+ fi
78+
79+
80+ - name : Upload ruff artifact
6681 if : always() && matrix.test-type == 'ruff'
6782 uses : actions/upload-artifact@v4
6883 with :
@@ -75,15 +90,29 @@ jobs:
7590 with :
7691 name : pylint-results
7792 path : pylint-output.txt
78-
93+
7994 - name : Upload Pytest Artifacts
80- if : always() && matrix.test-type == 'pytest' && hashFiles('pytest-output.txt', 'junit/test-results.xml', 'coverage.xml')
95+ if : always() && matrix.test-type == 'pytest'
8196 uses : actions/upload-artifact@v4
8297 with :
8398 name : pytest-results
8499 path : |
85- pytest_output .txt
100+ pytest-output .txt
86101 junit/test-results.xml
87102 coverage.xml
88103 htmlcov/
89-
104+ continue-on-error : true
105+
106+ - name : Upload docstr coverage report
107+ if : always() && matrix.test-type == 'docstrcov'
108+ uses : actions/upload-artifact@v4
109+ with :
110+ name : docstr-coverage
111+ path : docstr-cov-output.txt
112+
113+ - name : Upload bandit security report
114+ if : always() && matrix.test-type == 'security'
115+ uses : actions/upload-artifact@v4
116+ with :
117+ name : bandit-output
118+ path : bandit-output.json
0 commit comments