Skip to content
Closed
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
58 changes: 39 additions & 19 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: dev-test-code
name: CI-dev-pipeline

on:
push:
branches:
- dev
paths-ignore:
- "scripts/**"
- "BlocksScreen/lib/ui/**"
- "extras/**"
pull_request:
branches:
- dev
Expand All @@ -22,7 +15,8 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.11.2"]
test-type: [ruff, pylint, pytest]
test-type: [ruff, pylint, pytest, docstrcov, security]

steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -31,12 +25,14 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache: pip
cache-dependency-path: scripts/requirements-dev.txt

- name: Install dependencies
run: |
echo "Installing dependencies"
python -m pip install --upgrade pip
pip install scripts -r scripts/requirements-dev.txt
pip install -r scripts/requirements-dev.txt

- name: Run Test ${{ matrix.test-type }}
run: |
Expand All @@ -48,21 +44,31 @@ jobs:
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 "Running Pylint Code Test"
pylint -j$(nproc) --recursive=y BlocksScreen/ > 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
pytest tests/ --doctest-modules --junitxml=junit/test-results.xml --cov=BlocksScreen/ --cov-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 [ "${{ matrix.test-type }}" == "docstrcov" ]; then
echo "Running docstring coverage test"
docstr-coverage BlocksScreen/ --exclude '.*/BlocksScreen/lib/ui/.*?$' --fail-under=80 --skip-magic --skip-init --skip-private --skip-property > docstr-cov-output.txt 2>&1
fi

if [ "${{matrix.test-type }}" == "security" ]; then
echo "Running bandit security test"
bandit -c pyproject.toml -r . -f json -o bandit-output.json 2>&1
fi

- name: Upload ruff artifact
if: always() && matrix.test-type == 'ruff'
uses: actions/upload-artifact@v4
with:
Expand All @@ -75,15 +81,29 @@ jobs:
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')
if: always() && matrix.test-type == 'pytest'
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: |
pytest_output.txt
pytest-output.txt
junit/test-results.xml
coverage.xml
htmlcov/

continue-on-error: true

- name: Upload docstr coverage report
if: always() && matrix.test-type == 'docstrcov'
uses: actions/upload-artifact@v4
with:
name: docstr-coverage
path: docstr-cov-output.txt

- name: Upload bandit security report
if: always() && matrix.test-type == 'security'
uses: actions/upload-artifact@v4
with:
name: bandit-output
path: bandit-output.json
23 changes: 23 additions & 0 deletions .github/workflows/stage-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: stage-ci

on:
branches:
- stage
paths-ignore:
- "scripts/**"
- "BlocksScreen/lib/ui/**"
- "extras/**"
workflow_run:
workflows: ["dev-test-code"]
types:
- completed
jobs:
ci-stage:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Run staging pipeline
run: echo "Running staging integration tests..."
7 changes: 3 additions & 4 deletions BlocksScreen/BlocksScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@
RESET = "\033[0m"


def setup_working_dir(): ...


def setup_app_loggers():
ql = logger.create_logger(name="logs/BlocksScreen.log", level=logging.DEBUG)
"""Setup logger"""
_ = logger.create_logger(name="logs/BlocksScreen.log", level=logging.DEBUG)
_logger = logging.getLogger(name="logs/BlocksScreen.log")
_logger.info("============ BlocksScreen Initializing ============")


def show_splash(window: typing.Optional[QtWidgets.QWidget] = None):
"""Show splash screen on app initialization"""
logo = QtGui.QPixmap("BlocksScreen/BlocksScreen/lib/ui/resources/logoblocks.png")
splash = QtWidgets.QSplashScreen(pixmap=logo)
splash.setGeometry(QtCore.QRect(0, 0, 400, 200))
Expand Down
Loading