Skip to content

Commit 2641840

Browse files
authored
Merge pull request #975 from skalenetwork/beta
Beta to stable - 5.0
2 parents 69971c0 + 2c4d370 commit 2641840

125 files changed

Lines changed: 7892 additions & 3269 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/copilot-instructions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
- always keep the changes minimal and purposeful
2+
- focus on fixing the exact problem or implementing the exact feature
3+
- keep the code simple, do not write defensive code
4+
- do not describe your changes in details after you made changes, focus on writing code
5+
- do not generate any documentation, the code should be self-explanatory
6+
- do not generate any in-line comments
7+
- for the new files, always add a license header, same format as in the existing files
8+
- no commented out code
9+
- no console logs in production code
10+
- no unused imports
11+
- no redundant code - move repeated logic into helper functions
12+
- use type hints to specify the expected types of function arguments and return values
13+
14+
- check `pyproject.toml` for formatting rules
15+
- always lint changes using `uv run ruff check`
16+
- tests should be placed in `tests/` directory, follow the existing structure and code style
17+
- always use `uv` to run all commands in the repo (e.g., `uv run ruff`, `uv run pytest`, etc.)
18+
- for running tests, export environment variables in the terminal before running the tests: `. ./scripts/export_env.sh`
19+
20+
- additional external context is located in context directory

.github/workflows/publish.yml

Lines changed: 50 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,78 @@
11
name: Build and publish
2+
23
on:
34
pull_request:
45
types: [closed]
56
branches:
6-
- master
77
- develop
88
- beta
99
- stable
1010
- 'v*.*.*'
1111

1212
jobs:
13-
create_release:
13+
build_and_release:
1414
if: github.event.pull_request.merged
15-
name: Create release
15+
name: Build and create release
1616
runs-on: ubuntu-22.04
17-
outputs:
18-
upload_url: ${{ steps.create_release.outputs.upload_url }}
19-
version: ${{ steps.export_outputs.outputs.version }}
20-
branch: ${{ steps.export_outputs.outputs.branch }}
17+
permissions:
18+
contents: write
2119
steps:
2220
- name: Checkout code
23-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2422
with:
2523
submodules: true
2624

27-
- name: Checkout submodules
28-
run: git submodule update --init
29-
30-
- name: Install ubuntu dependencies
31-
run: |
32-
sudo apt-get update
33-
sudo apt-get install python-setuptools
25+
- name: Set up Python 3.13
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: 3.13
3429

35-
- name: Set Versions
30+
- name: Calculate version
31+
id: versioning
3632
run: |
3733
bash ./scripts/set_versions_ga.sh
38-
39-
- name: Set release
34+
35+
- name: Determine prerelease status
36+
id: release_info
4037
run: |
41-
if [[ "$BRANCH" == "stable" ]]; then
42-
export PRERELEASE=false
38+
if [[ "${{ env.BRANCH }}" == "stable" ]]; then
39+
echo "prerelease=false" >> $GITHUB_OUTPUT
4340
else
44-
export PRERELEASE=true
41+
echo "prerelease=true" >> $GITHUB_OUTPUT
4542
fi
46-
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
4743
48-
- name: Create Release
49-
id: create_release
50-
uses: actions/create-release@v1
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Build binaries
45+
id: build
46+
run: |
47+
mkdir -p ${{ github.workspace }}/dist
48+
docker build . -t node-cli-builder
49+
50+
docker run --rm -v ${{ github.workspace }}/dist:/app/dist node-cli-builder \
51+
bash scripts/build.sh ${{ env.VERSION }} ${{ env.BRANCH }} skale
52+
53+
docker run --rm -v ${{ github.workspace }}/dist:/app/dist node-cli-builder \
54+
bash scripts/build.sh ${{ env.VERSION }} ${{ env.BRANCH }} fair
55+
56+
echo "dist_path=${{ github.workspace }}/dist" >> $GITHUB_OUTPUT
57+
58+
- name: Generate checksums
59+
run: |
60+
cd ${{ steps.build.outputs.dist_path }}
61+
for file in skale-*; do
62+
sha512sum "$file" > "$file.sha512"
63+
done
64+
echo "Checksums generated:"
65+
ls -l *.sha512
66+
67+
- name: Create GitHub release
68+
uses: softprops/action-gh-release@v2
5369
with:
5470
tag_name: ${{ env.VERSION }}
55-
release_name: ${{ env.VERSION }}
71+
name: Release ${{ env.VERSION }}
5672
draft: false
57-
prerelease: ${{ env.PRERELEASE }}
58-
- name: Export outputs
59-
id: export_outputs
60-
run: |
61-
echo "::set-output name=version::$VERSION"
62-
echo "::set-output name=branch::$BRANCH"
63-
64-
build_and_publish_normal:
65-
if: github.event.pull_request.merged
66-
needs: create_release
67-
name: Build and publish for ${{ matrix.os }}
68-
runs-on: ${{ matrix.os }}
69-
strategy:
70-
matrix:
71-
include:
72-
- os: ubuntu-22.04
73-
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64
74-
steps:
75-
- uses: actions/checkout@v2
76-
- name: Set up Python 3.11
77-
uses: actions/setup-python@v1
78-
with:
79-
python-version: 3.11
80-
81-
- name: Install ubuntu dependencies
82-
if: matrix.os == 'ubuntu-22.04'
83-
run: |
84-
sudo apt-get update
85-
86-
- name: Checkout submodules
87-
run: git submodule update --init
88-
89-
- name: Build normal binary
90-
run: |
91-
mkdir -p ./dist
92-
docker build . -t node-cli-builder
93-
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} normal
94-
ls -altr /home/ubuntu/dist/
95-
docker rm -f $(docker ps -aq)
96-
97-
- name: Save sha512sum
98-
run: |
99-
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
100-
101-
- name: Upload release binary
102-
id: upload-release-asset
103-
uses: actions/upload-release-asset@v1
104-
env:
105-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106-
with:
107-
upload_url: ${{ needs.create_release.outputs.upload_url }}
108-
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
109-
asset_name: ${{ matrix.asset_name }}
110-
asset_content_type: application/octet-stream
111-
112-
- name: Upload release checksum
113-
id: upload-release-checksum
114-
uses: actions/upload-release-asset@v1
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117-
with:
118-
upload_url: ${{ needs.create_release.outputs.upload_url }}
119-
asset_path: /home/ubuntu/dist/sha512sum
120-
asset_name: ${{ matrix.asset_name }}.sha512
121-
asset_content_type: text/plain
122-
123-
build_and_publish_sync:
124-
if: github.event.pull_request.merged
125-
needs: create_release
126-
name: Build and publish for ${{ matrix.os }}
127-
runs-on: ${{ matrix.os }}
128-
strategy:
129-
matrix:
130-
include:
131-
- os: ubuntu-22.04
132-
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64-sync
133-
steps:
134-
- uses: actions/checkout@v2
135-
- name: Set up Python 3.11
136-
uses: actions/setup-python@v1
137-
with:
138-
python-version: 3.11
139-
140-
- name: Install ubuntu dependencies
141-
if: matrix.os == 'ubuntu-22.04'
142-
run: |
143-
sudo apt-get update
144-
145-
- name: Checkout submodules
146-
run: git submodule update --init
147-
148-
- name: Build sync release binary
149-
run: |
150-
mkdir -p ./dist
151-
docker build . -t node-cli-builder
152-
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} sync
153-
ls -altr /home/ubuntu/dist/
154-
docker rm -f $(docker ps -aq)
155-
156-
- name: Save sha512sum
157-
run: |
158-
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
159-
160-
- name: Upload release sync CLI
161-
id: upload-sync-release-asset
162-
uses: actions/upload-release-asset@v1
163-
env:
164-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165-
with:
166-
upload_url: ${{ needs.create_release.outputs.upload_url }}
167-
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
168-
asset_name: ${{ matrix.asset_name }}
169-
asset_content_type: application/octet-stream
170-
171-
- name: Upload release sync CLI checksum
172-
id: upload-sync-release-checksum
173-
uses: actions/upload-release-asset@v1
174-
env:
175-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176-
with:
177-
upload_url: ${{ needs.create_release.outputs.upload_url }}
178-
asset_path: /home/ubuntu/dist/sha512sum
179-
asset_name: ${{ matrix.asset_name }}.sha512
180-
asset_content_type: text/plain
73+
prerelease: ${{ steps.release_info.outputs.prerelease }}
74+
generate_release_notes: true
75+
files: |
76+
${{ steps.build.outputs.dist_path }}/skale-*
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,85 @@
11
name: Test
2-
on: [push, pull_request]
2+
on: [push]
33

44
jobs:
55
test:
66
runs-on: ubuntu-22.04
77
strategy:
88
matrix:
9-
python-version: [3.11]
9+
python-version: ['3.13']
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212
with:
1313
submodules: true
1414

1515
- name: Checkout submodules
1616
run: git submodule update --init
1717

1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222

23+
- name: Install uv
24+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
25+
26+
- name: Cache uv
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/uv
30+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
31+
2332
- name: Install ubuntu dependencies
2433
run: |
2534
sudo apt-get update
2635
sudo apt-get install iptables nftables python3-nftables
2736
2837
- name: Install python dependencies
2938
run: |
30-
python -m pip install --upgrade pip
31-
pip install -e .[dev]
39+
uv venv
40+
uv pip install -e ".[dev]"
41+
42+
- name: Generate info
43+
run: bash ./scripts/generate_info.sh 1.0.0 my-branch skale
3244

33-
- name: Lint with flake8
45+
- name: Check with ruff
3446
run: |
35-
flake8 .
47+
uv run ruff check
3648
37-
- name: Build binary - normal
49+
- name: Build docker image
50+
run: docker build . -t node-cli-builder
51+
52+
- name: Build binary - skale
3853
run: |
3954
mkdir -p ./dist
40-
docker build . -t node-cli-builder
41-
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh test test normal
55+
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder bash scripts/build.sh test test skale
4256
docker rm -f $(docker ps -aq)
4357
44-
- name: Check build - normal
58+
- name: Check build - skale
4559
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64
4660

47-
- name: Build binary - sync
61+
- name: Build binary - fair
4862
run: |
4963
mkdir -p ./dist
50-
docker build . -t node-cli-builder
51-
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh test test sync
64+
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder bash scripts/build.sh test test fair
5265
docker rm -f $(docker ps -aq)
5366
54-
- name: Check build - sync
55-
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync
67+
- name: Check build - fair
68+
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-fair
5669

5770
- name: Run prepare test build
5871
run: |
59-
scripts/build.sh test test normal
72+
uv run bash scripts/build.sh test test skale
73+
74+
- name: Run redis
75+
run: |
76+
bash ./helper-scripts/redis/run.sh
6077
6178
- name: Run tests
6279
run: |
6380
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages/
64-
bash ./scripts/run_tests.sh
81+
uv run bash ./scripts/run_tests.sh
6582
6683
- name: Run nftables tests
6784
run: |
68-
scripts/run_nftables_test.sh
85+
uv run scripts/run_nftables_test.sh

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,16 @@ node_cli/cli/info.py
113113

114114
meta.json
115115

116-
disk_mountpoint.txt
116+
block_device.txt
117117
sgx_server_url.txt
118118
resource_allocation.json
119119
conf.json
120120
test-env
121121

122-
nginx.conf
122+
nginx.conf
123+
tests/.skale/node_data/docker.json
124+
tests/.skale/node_data/node_options.json
125+
tests/.skale/config/nginx.conf.j2
126+
127+
.zed
128+
uv.lock

0 commit comments

Comments
 (0)