diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c98b7c95..6239d0bd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,7 +13,7 @@ jobs: build_and_release: if: github.event.pull_request.merged name: Build and create release - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: contents: write steps: @@ -22,10 +22,10 @@ jobs: with: submodules: true - - name: Set up Python 3.13 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: '3.14' - name: Calculate version id: versioning diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f589d47..6c9935f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,10 +3,10 @@ on: [push] jobs: test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: matrix: - python-version: ['3.13'] + python-version: ['3.14'] steps: - uses: actions/checkout@v4 with: @@ -38,6 +38,8 @@ jobs: run: | uv venv uv pip install -e ".[dev]" + site_packages=$(uv run python -c 'import site; print(site.getsitepackages()[0])') + echo /usr/lib/python3/dist-packages > "$site_packages/ubuntu-system-packages.pth" - name: Generate info run: bash ./scripts/generate_info.sh 1.0.0 my-branch skale @@ -77,7 +79,6 @@ jobs: - name: Run tests run: | - export PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages/ uv run bash ./scripts/run_tests.sh - name: Run nftables tests diff --git a/Dockerfile b/Dockerfile index 7fc37545..835de85b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,53 @@ -FROM python:3.13-slim-bookworm AS builder +FROM ubuntu:24.04 AS builder + +ARG PYTHON_VERSION=3.13 + +ENV DEBIAN_FRONTEND=noninteractive +ENV UV_PYTHON_INSTALL_DIR=/opt/python COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates && \ + rm -rf /var/lib/apt/lists/* + WORKDIR /app COPY pyproject.toml ./ -RUN uv pip install --system --no-cache ".[dev]" +RUN uv python install "$PYTHON_VERSION" && \ + uv venv --python "$PYTHON_VERSION" /opt/venv && \ + uv pip install --python /opt/venv --no-cache ".[dev]" -FROM python:3.13-slim-bookworm +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ + binutils \ + ca-certificates \ git \ iptables \ + kmod \ nftables \ + patchelf \ python3-nftables \ - kmod \ - wget \ - binutils && \ + wget && \ rm -rf /var/lib/apt/lists/* WORKDIR /app -COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages -COPY --from=builder /usr/local/bin /usr/local/bin +COPY --from=builder /opt/python /opt/python +COPY --from=builder /opt/venv /opt/venv + +RUN printf '%s\n' '/usr/lib/python3/dist-packages' \ + > /opt/venv/lib/python3.13/site-packages/ubuntu-system-packages.pth COPY . . -ENV PYTHONPATH="/app:/usr/lib/python3/dist-packages" +RUN patchelf --remove-needed libSegFault.so datafiles/skaled-ssl-test + +ENV PATH="/opt/venv/bin:$PATH" +ENV PYTHONPATH="/app" ENV COLUMNS=80 diff --git a/node_cli/cli/passive_node.py b/node_cli/cli/passive_node.py index f86ba99b..b1ccf086 100644 --- a/node_cli/cli/passive_node.py +++ b/node_cli/cli/passive_node.py @@ -83,4 +83,4 @@ def _update_passive(env_file): @click.option('--prune', is_flag=True, help='Prune docker system.') @streamed_cmd def cleanup_node(prune): - cleanup_skale(node_mode=NodeMode.PASSIVE, prune=prune) \ No newline at end of file + cleanup_skale(node_mode=NodeMode.PASSIVE, prune=prune) diff --git a/node_cli/core/checks.py b/node_cli/core/checks.py index 0424577f..ecc613fb 100644 --- a/node_cli/core/checks.py +++ b/node_cli/core/checks.py @@ -166,9 +166,11 @@ def get_checks(self, check_type: CheckType = CheckType.ALL) -> FuncList: methods = inspect.getmembers( type(self), - predicate=lambda m: inspect.isfunction(m) - and getattr(m, '_check_type', None) in allowed_types - and self.requirements.get(m.__name__, None) != 'disabled', + predicate=lambda m: ( + inspect.isfunction(m) + and getattr(m, '_check_type', None) in allowed_types + and self.requirements.get(m.__name__, None) != 'disabled' + ), ) return [functools.partial(m[1], self) for m in methods] diff --git a/pyproject.toml b/pyproject.toml index 38f32873..652dedcb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "node-cli" -version = "3.3.1" +version = "3.3.2" description = "Node CLI tools" readme = "README.md" requires-python = ">=3.13" diff --git a/tests/cli/health_test.py b/tests/cli/health_test.py index 1d7b58db..7b75c02c 100644 --- a/tests/cli/health_test.py +++ b/tests/cli/health_test.py @@ -81,7 +81,9 @@ def test_checks(): == 'sChain Name Config directory DKG Config file Volume Container IMA Firewall RPC Blocks\n-------------------------------------------------------------------------------------------------------------\ntest_schain True False False False False False False False False \n' # noqa ) - result = run_command_mock('node_cli.utils.helper.api_session.get', resp_mock, schains, ['--json']) + result = run_command_mock( + 'node_cli.utils.helper.api_session.get', resp_mock, schains, ['--json'] + ) assert result.exit_code == 0 assert (