1+ name : dev-test-code
2+
3+ on :
4+ push :
5+ branches :
6+ - dev
7+ paths-ignore :
8+ - " scripts/**"
9+ - " BlocksScreen/lib/ui/**"
10+ - " extras/**"
11+ pull_request :
12+ branches :
13+ - dev
14+ paths-ignore :
15+ - " scripts/**"
16+ - " BlocksScreen/lib/ui/**"
17+ - " extras/**"
18+ jobs :
19+ ci-checks :
20+ runs-on : ubuntu-latest
21+ strategy :
22+ fail-fast : false
23+ matrix :
24+ python-version : ["3.11.2"]
25+ test-type : [ruff, pylint, pytest]
26+ steps :
27+ - name : Checkout repo
28+ uses : actions/checkout@v4
29+
30+ - name : Set up Python ${{ matrix.python-version }}
31+ uses : actions/setup-python@v4
32+ with :
33+ python-version : ${{ matrix.python-version }}
34+ cache : " pip"
35+ - name : Install dependencies
36+ run : |
37+ echo "Installing dependencies"
38+ python -m pip install --upgrade pip
39+ pip install scripts -r scripts/requirements-dev.txt
40+
41+ - name : Run Test ${{ matrix.test-type }}
42+ run : |
43+ echo "Starting test runs"
44+ if [ "${{ matrix.test-type }}" == "ruff" ]; then
45+ echo "Running Formatting Test"
46+ ruff check --output-format=github --target-version=py311 --config=pyproject.toml > ruff-output.txt 2>&1
47+ ruff format --diff --target-version=py311 --config=pyproject.toml >> ruff-output.txt 2>&1
48+ echo "Ruff finished"
49+ fi
50+ 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
53+ echo "Pylint finished"
54+ fi
55+
56+ if [ "${{ matrix.test-type }}" == "pytest" ]; then
57+ if [ -d "tests/" ] && [ "$(ls -A tests/)" ]; then
58+ 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
60+ else
61+ echo "No tests directory no need to proceed with tests"
62+ fi
63+ fi
64+
65+ - name : Upload ruff artifact
66+ if : always() && matrix.test-type == 'ruff'
67+ uses : actions/upload-artifact@v4
68+ with :
69+ name : ruff-results
70+ path : ruff-output.txt
71+
72+ - name : Upload Pylint Artifacts
73+ if : always() && matrix.test-type == 'pylint'
74+ uses : actions/upload-artifact@v4
75+ with :
76+ name : pylint-results
77+ path : pylint-output.txt
78+
79+ - name : Upload Pytest Artifacts
80+ if : always() && matrix.test-type == 'pytest' && hashFiles('pytest-output.txt', 'junit/test-results.xml', 'coverage.xml')
81+ uses : actions/upload-artifact@v4
82+ with :
83+ name : pytest-results
84+ path : |
85+ pytest_output.txt
86+ junit/test-results.xml
87+ coverage.xml
88+ htmlcov/
89+
0 commit comments