Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
371d712
Add pyproject.toml
alexgex Nov 19, 2025
0eeb193
Add classifiers and keywords
alexgex Nov 20, 2025
798d273
Add homepage url
alexgex Nov 20, 2025
1f458f5
Exclude the tests directory from the final package
alexgex Nov 20, 2025
e6d4b12
Set `include_package_data` to `True`
alexgex Nov 20, 2025
87ecf0d
Bump Python version to 3.13
alexgex Nov 20, 2025
74c5719
Update dependencies
alexgex Nov 20, 2025
357d12d
Delete outdated setup.py
alexgex Nov 20, 2025
0c1e0d8
Use `python:3.13-bookworm`
alexgex Nov 20, 2025
1768b73
Bump Python and actions version
alexgex Nov 20, 2025
a80db48
Delete unused ruff.toml
alexgex Nov 20, 2025
239bcf1
Handle `OSError` exception
alexgex Nov 20, 2025
37781b9
Use 'Group' instead of deprecated 'MultiCommand'
alexgex Nov 21, 2025
2c77239
Disable warnings from static analyzer
alexgex Nov 21, 2025
6c5b526
Replace `str_to_bool` with a new implementation without deleted `dist…
alexgex Nov 21, 2025
f4c68cc
Update all dependencies to their latest versions
alexgex Nov 21, 2025
108257d
Bump `setuptools` version to 80.9.0
alexgex Nov 21, 2025
e3dbf31
Update `dev` dependencies to their latest versions
alexgex Nov 21, 2025
258d964
Use builder, slim image and uv
alexgex Nov 21, 2025
52e8a60
Install `binutils`
alexgex Nov 21, 2025
3ff9c2f
Bump `python-dateutil` version to 2.9.0.post0
alexgex Nov 24, 2025
bff05d8
Set `quote-style` to "single"
alexgex Nov 24, 2025
e791fb8
Use `uv` for installing dependencies
alexgex Nov 24, 2025
4bd90cc
Create `venv`
alexgex Nov 24, 2025
623e821
Run `prepare test build` in `venv`
alexgex Nov 24, 2025
c72148b
Bump Python version to 3.13
alexgex Nov 24, 2025
7f0f2f0
Use importlib.metadata to get package version
alexgex Nov 24, 2025
6c94e9a
Get version from 'pyproject.toml'
alexgex Nov 24, 2025
0fdbbdd
Modernize and simplify the release workflow
alexgex Nov 24, 2025
1fc9118
Add new branch for new release workflow testing
alexgex Nov 24, 2025
e0c77ff
Merge pull request #949 from skalenetwork/test-new-release-workflow
alexgex Nov 24, 2025
cac1d9b
Generate `generate_release_notes`
alexgex Nov 24, 2025
c4400ae
Merge pull request #950 from skalenetwork/test-new-release-workflow
alexgex Nov 24, 2025
a7d7479
Remove test branch and improve task names
alexgex Nov 25, 2025
46baade
Build `node-cli-builder` only once
alexgex Nov 25, 2025
94122ea
Make PyInstaller spec paths absolute
alexgex Nov 25, 2025
e0b77cd
Remove `PackageNotFoundError` handling
alexgex Nov 25, 2025
1f953bb
Move the configuration from `pytest.ini` to `pyproject.toml`
alexgex Dec 29, 2025
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
150 changes: 44 additions & 106 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,140 +1,78 @@
name: Build and publish

on:
pull_request:
types: [closed]
branches:
- master
- develop
- beta
- stable
- 'v*.*.*'
- 'fair'
- 'fair-*'

jobs:
create_release:
build_and_release:
if: github.event.pull_request.merged
name: Create release
name: Build and create release
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.export_outputs.outputs.version }}
branch: ${{ steps.export_outputs.outputs.branch }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install python-setuptools

- name: Set Versions
run: |
bash ./scripts/set_versions_ga.sh

- name: Set release
run: |
if [[ "$BRANCH" == "stable" ]]; then
export PRERELEASE=false
else
export PRERELEASE=true
fi
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: false
prerelease: ${{ env.PRERELEASE }}

- name: Export outputs
id: export_outputs
run: |
echo "::set-output name=version::$VERSION"
echo "::set-output name=branch::$BRANCH"

build_and_publish:
if: github.event.pull_request.merged
needs: create_release
name: Build and publish ${{ matrix.build_type }} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
build_type: [skale, fair]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
submodules: true
python-version: 3.13

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-22.04'
- name: Calculate version
id: versioning
run: |
sudo apt-get update

- name: Ensure submodules are updated
run: git submodule update --init --recursive

- name: Define Asset Name
id: asset_details
bash ./scripts/set_versions_ga.sh

- name: Determine prerelease status
id: release_info
run: |
ASSET_BASE_NAME="skale-${{ needs.create_release.outputs.version }}-Linux-x86_64"
if [[ "${{ matrix.build_type }}" == "skale" ]]; then
echo "FINAL_ASSET_NAME=${ASSET_BASE_NAME}" >> $GITHUB_OUTPUT
if [[ "${{ env.BRANCH }}" == "stable" ]]; then
echo "prerelease=false" >> $GITHUB_OUTPUT
else
echo "FINAL_ASSET_NAME=${ASSET_BASE_NAME}-${{ matrix.build_type }}" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
fi

- name: Build ${{ matrix.build_type }} release binary
- name: Build binaries
id: build
run: |
mkdir -p ${{ github.workspace }}/dist
docker build . -t node-cli-builder

docker run --rm -v ${{ github.workspace }}/dist:/app/dist node-cli-builder \
bash scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} ${{ matrix.build_type }}
echo "Contents of dist directory:"
ls -altr ${{ github.workspace }}/dist/
docker rm -f $(docker ps -aq) || true

- name: Save sha512sum for ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}
bash scripts/build.sh ${{ env.VERSION }} ${{ env.BRANCH }} skale

docker run --rm -v ${{ github.workspace }}/dist:/app/dist node-cli-builder \
bash scripts/build.sh ${{ env.VERSION }} ${{ env.BRANCH }} fair

echo "dist_path=${{ github.workspace }}/dist" >> $GITHUB_OUTPUT

- name: Generate checksums
run: |
cd ${{ github.workspace }}/dist
sha512sum ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }} > ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}.sha512sum
echo "Checksum file created: ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}.sha512sum"
cat ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}.sha512sum

- name: Upload release binary (${{ matrix.build_type }})
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cd ${{ steps.build.outputs.dist_path }}
for file in skale-*; do
sha512sum "$file" > "$file.sha512"
done
echo "Checksums generated:"
ls -l *.sha512

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/dist/${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}
asset_name: ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}
asset_content_type: application/octet-stream

- name: Upload release checksum (${{ matrix.build_type }})
uses: actions/upload-release-asset@v1
tag_name: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
draft: false
prerelease: ${{ steps.release_info.outputs.prerelease }}
generate_release_notes: true
files: |
${{ steps.build.outputs.dist_path }}/skale-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/dist/${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}.sha512sum
asset_name: ${{ steps.asset_details.outputs.FINAL_ASSET_NAME }}.sha512
asset_content_type: text/plain
32 changes: 21 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,52 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.11]
python-version: ['3.13']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

- name: Checkout submodules
run: git submodule update --init

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

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

- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}

- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install iptables nftables python3-nftables

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
uv venv
uv pip install -e ".[dev]"

- name: Generate info
run: bash ./scripts/generate_info.sh 1.0.0 my-branch skale

- name: Check with ruff
run: |
ruff check
uv run ruff check

- name: Build docker image
run: docker build . -t node-cli-builder

- name: Build binary - skale
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder bash scripts/build.sh test test skale
docker rm -f $(docker ps -aq)

Expand All @@ -50,7 +61,6 @@ jobs:
- name: Build binary - fair
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder bash scripts/build.sh test test fair
docker rm -f $(docker ps -aq)

Expand All @@ -59,7 +69,7 @@ jobs:

- name: Run prepare test build
run: |
bash scripts/build.sh test test skale
uv run bash scripts/build.sh test test skale

- name: Run redis
run: |
Expand All @@ -68,8 +78,8 @@ jobs:
- name: Run tests
run: |
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages/
bash ./scripts/run_tests.sh
uv run bash ./scripts/run_tests.sh

- name: Run nftables tests
run: |
scripts/run_nftables_test.sh
uv run scripts/run_nftables_test.sh
45 changes: 24 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
FROM python:3.11-bookworm
FROM python:3.13-slim-bookworm AS builder

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt install -y \
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

COPY pyproject.toml ./

RUN uv pip install --system --no-cache ".[dev]"

FROM python:3.13-slim-bookworm

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
build-essential \
software-properties-common \
zlib1g-dev \
libssl-dev \
libffi-dev \
swig \
iptables \
nftables \
python3-nftables \
libxslt-dev \
kmod

nftables \
python3-nftables \
kmod \
wget \
binutils && \
rm -rf /var/lib/apt/lists/*

RUN mkdir /app
WORKDIR /app

COPY . .
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

ENV PATH=/app/buildvenv/bin:$PATH
ENV PYTHONPATH="{PYTHONPATH}:/usr/lib/python3/dist-packages"
COPY . .

RUN pip install --upgrade pip && \
pip install wheel setuptools==63.2.0 && \
pip install -e '.[dev]'
ENV PYTHONPATH="/app:/usr/lib/python3/dist-packages"
ENV COLUMNS=80
9 changes: 4 additions & 5 deletions main.spec
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# -*- mode: python -*-

import importlib.util

import os

block_cipher = None

a = Analysis(
['node_cli/main.py'],
pathex=['.'],
pathex=[SPECPATH],
datas=[
("./text.yml", "data"),
("./datafiles/skaled-ssl-test", "data/datafiles")
(os.path.join(SPECPATH, "text.yml"), "data"),
(os.path.join(SPECPATH, "datafiles/skaled-ssl-test"), "data/datafiles")
],
hiddenimports=[],
hookspath=[],
Expand Down
4 changes: 3 additions & 1 deletion node_cli/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
__version__ = '3.2.0'
from importlib.metadata import version

__version__ = version("node-cli")

if __name__ == '__main__':
print(__version__)
Loading