Skip to content

Commit

Permalink
scripts: fix dev dependencies usage
Browse files Browse the repository at this point in the history
  • Loading branch information
seppzer0 committed Sep 14, 2024
1 parent ffc5cd0 commit f943c31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Build And Assemble
run: |
python3 -m pip install -r uv-version.txt
python3 -m uv sync --frozen --no-install-project
uv sync --frozen --no-install-project
export PYTHONPATH=$(pwd)
python3 scripts/run_tests.py
python3 scripts/multi_build.py
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ job-build:
script:
- apk update && apk add python3 py3-pip
- python3 -m pip install -r uv-version.txt --break-system-packages
- python3 -m uv sync --frozen --no-install-project
- uv sync --frozen --no-install-project
- export PYTHONPATH=$(pwd)
- python3 scripts/run_tests.py
- python3 scripts/multi_build.py
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN \
# configure Python environment
RUN python3 -m pip install pip --upgrade && \
python3 -m pip install -r uv-version.txt && \
python3 -m uv sync --frozen --no-install-project
uv sync --frozen --no-install-project

# install shared tools from tools.json;
#
Expand Down
8 changes: 3 additions & 5 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import platform
import subprocess
from pathlib import Path
from subprocess import CompletedProcess

ROOTPATH: Path = Path(__file__).absolute().parents[1]
INTEPRETER: str = "python" if platform.system() == "Windows" else "python3"


class Tester:
Expand All @@ -19,21 +17,21 @@ def _launch_cmd(cmd: str) -> CompletedProcess:
def pyright_check(self) -> None:
"""Run typing checks with Pyright."""
print("\n=== Pyright checks: Start ===")
self._launch_cmd(f"{INTEPRETER} -m pyright")
self._launch_cmd("uv run python -m pyright")
print("=== Pyright checks: Finish ===")

def pytest_check(self) -> None:
"""Run unit tests with Pytest and coverage checks."""
os.environ["PYTHONPATH"] = str(ROOTPATH)
print("\n=== Pytest checks: Start ===")
self._launch_cmd(f"{INTEPRETER} -m pytest -vv tests/ --cov")
self._launch_cmd("uv run python -m pytest -vv tests/ --cov")
print("=== Pytest checks: Finish ===")

def bandit_check(self) -> None:
"""Run SAST with Bandit."""
fmts = ("json", "html")
for fmt in fmts:
self._launch_cmd(f"python3 -m bandit -r -f {fmt} {ROOTPATH} -o report.{fmt}")
self._launch_cmd(f"uv run python -m bandit -r -f {fmt} {ROOTPATH} -o report.{fmt}")


def main() -> None:
Expand Down

0 comments on commit f943c31

Please sign in to comment.