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
85 changes: 74 additions & 11 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,82 @@ on:
- main

jobs:
setup-venv:
name: set up shared virtual environment
runs-on: ubuntu-latest

steps:
- name: checkout code
uses: actions/checkout@v4

- name: set up python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: cache virtual environment
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-shared-venv-${{ github.run_id }}

- name: sync virtual environment
run: |
uv sync --group all

codestyle:
name: ruff codestyle check/linting
runs-on: ubuntu-latest
needs: setup-venv

strategy:
fail-fast: false
matrix:
tool: [ruff, ty, ruff-extensive]

steps:
- name: checkout code
uses: actions/checkout@v4

- name: set up python 3.11
uses: actions/setup-python@v3
- name: set up python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: "3.13"

- name: install ruff
run: pip install ruff
- name: restore virtual environment
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-shared-venv-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-shared-venv-

- name: run ruff linter src directory
run: ruff check hololinked
if: matrix.tool == 'ruff'
run: |
source .venv/bin/activate
ruff check --config pyproject.toml hololinked

- name: run ruff linter tests directory
run: ruff check tests/*.py tests/things/*.py tests/helper-scripts/*.py
if: matrix.tool == 'ruff'
run: |
source .venv/bin/activate
ruff check --config pyproject.toml tests/*.py tests/things/*.py tests/helper-scripts/*.py

- name: run ruff linter src directory
if: matrix.tool == 'ruff-extensive'
run: |
source .venv/bin/activate
ruff check --config ruff.toml hololinked/client

- name: run ty type checker
if: matrix.tool == 'ty'
run: |
source .venv/bin/activate
ty check hololinked/client

scan:
name: security scan (${{ matrix.tool }})
Expand All @@ -49,25 +104,32 @@ jobs:
fetch-depth: 0

# ---------------- Bandit branch ----------------
- name: set up python 3.11
- name: set up python 3.13
if: matrix.tool == 'bandit'
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"

- name: install bandit
- name: restore virtual environment
if: matrix.tool == 'bandit'
run: pip install bandit
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-shared-venv-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-shared-venv-

- name: run bandit scan
if: matrix.tool == 'bandit'
run: |
source .venv/bin/activate
bandit -c pyproject.toml -r hololinked/ -b .bandit-baseline.json
# this is the step that will fail the job if new issues are found

- name: generate JSON report
if: matrix.tool == 'bandit'
run: |
source .venv/bin/activate
echo "Rerunning to generate bandit report in JSON format..."
bandit -c pyproject.toml -r hololinked/ -f json -b .bandit-baseline.json -o bandit-report.json

Expand All @@ -81,6 +143,7 @@ jobs:
- name: display existing issues, which have already been accounted
if: matrix.tool == 'bandit'
run: |
source .venv/bin/activate
echo "Rerunning to display existing issues which are included in the baseline..."
bandit -c pyproject.toml -r hololinked/ || true

Expand Down
2 changes: 2 additions & 0 deletions hololinked/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""expose client objects per protocol using the Thing Description."""

from ..config import global_config # noqa: F401
from .factory import ClientFactory as ClientFactory
from .proxy import ObjectProxy as ObjectProxy
Expand Down
Loading
Loading