Skip to content

Commit 04a3995

Browse files
authored
Merge pull request #262 from skalenetwork/develop
Develop to beta - 5.0
2 parents be10286 + 4101ef8 commit 04a3995

32 files changed

Lines changed: 459 additions & 406 deletions

.coveragerc

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

.dockerignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.git
2+
.github
3+
.venv
4+
.vscode
5+
.mypy_cache
6+
.pytest_cache
7+
.ruff_cache
8+
.DS_Store
9+
__pycache__
10+
*.pyc
11+
*.pyo
12+
*.pyd
13+
.Python
14+
*.log
15+
helper-scripts/
16+
hardhat-node/
17+
scripts/
18+
context/
19+
codecov.yml
20+
.codacy.yml
21+
.coveragerc
22+
.gitignore
23+
.gitmodules
24+
README.md

.env_template

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

.flake8

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

.github/workflows/publish.yml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- develop
88
- beta
99
- stable
10+
- "v*.*.*"
1011

1112
jobs:
1213
build:
@@ -16,30 +17,33 @@ jobs:
1617
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
1718
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
1819
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up Python 3.11
21-
uses: actions/setup-python@v1
22-
with:
23-
python-version: 3.11
24-
- name: Build and publish container
25-
run: |
26-
export BRANCH=${GITHUB_REF##*/}
27-
echo "Branch $BRANCH"
28-
export VERSION=$(bash ./scripts/calculate_version.sh)
29-
echo "VERSION=$VERSION" >> $GITHUB_ENV
30-
echo "Version $VERSION"
31-
export RELEASE=true
32-
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
33-
bash ./scripts/build_and_publish.sh
34-
- name: Checkout code
35-
uses: actions/checkout@master
36-
- name: Create Release
37-
id: create_release
38-
uses: actions/create-release@v1
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
with:
42-
tag_name: ${{ env.VERSION }}
43-
release_name: ${{ env.VERSION }}
44-
draft: false
45-
prerelease: true
20+
- uses: actions/checkout@v5
21+
with:
22+
submodules: true
23+
- name: Set up Python 3.13
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: 3.13
27+
- name: Build and publish container
28+
run: |
29+
export BRANCH=${GITHUB_REF##*/}
30+
export VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
31+
echo "Branch: $BRANCH"
32+
echo "Base version: $VERSION"
33+
export VERSION=$(bash ./helper-scripts/calculate_version.sh)
34+
echo "VERSION=$VERSION" >> $GITHUB_ENV
35+
echo "Version $VERSION"
36+
export RELEASE=true
37+
( test $BRANCH = "stable" && export PRERELEASE=false ) || export PRERELEASE=true
38+
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
39+
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
40+
export CONTAINER_NAME="bounty-agent"
41+
bash ./helper-scripts/build_and_publish.sh
42+
- name: Create Release
43+
uses: softprops/action-gh-release@v2
44+
with:
45+
tag_name: ${{ env.VERSION }}
46+
name: ${{ env.VERSION }}
47+
draft: false
48+
prerelease: ${{ github.base_ref != 'stable' }}
49+
generate_release_notes: true

.github/workflows/test.yml

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,51 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
env:
8-
ETH_PRIVATE_KEY: ${{ secrets.ETH_PRIVATE_KEY }}
9-
ENDPOINT: ${{ secrets.ENDPOINT }}
108
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
11-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
12-
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
13-
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
14-
DB_USER: ${{ secrets.DB_USER }}
15-
DB_ROOT_PASSWORD: ${{ secrets.DB_ROOT_PASSWORD }}
16-
DB_PORT: ${{ secrets.DB_PORT }}
17-
MANAGER_TAG: "1.9.3-beta.0"
189

1910
steps:
20-
- uses: actions/checkout@v2
21-
with:
22-
submodules: true
23-
- name: Set up Python 3.11
24-
uses: actions/setup-python@v1
25-
with:
26-
python-version: 3.11
27-
- name: Install deps
28-
run: |
29-
sudo apt-get update
30-
sudo apt-get install -y libmysqlclient-dev build-essential
31-
- name: Install python dependencies
32-
run: |
33-
python -m pip install --upgrade pip
34-
pip install -r requirements.txt
35-
pip install -r requirements-dev.txt
36-
- name: Lint with flake8
37-
run: |
38-
flake8 .
39-
- name: Deploy manager contracts and run MySQL container
40-
run: |
41-
#
42-
bash ./scripts/create_environment.sh
43-
- name: Run tests
44-
run: |
45-
export PYTHONPATH=$PYTHONPATH:.
46-
python tests/prepare_validator.py
47-
ENV=DEV py.test -v -s --cov=./ tests/ --cov-report term-missing
48-
- name: Codecov
49-
run: |
50-
codecov -t $CODECOV_TOKEN
11+
- uses: actions/checkout@v5
12+
with:
13+
submodules: true
14+
- name: Set up Python 3.13
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.13
18+
19+
- name: Install deps
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y build-essential
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
26+
with:
27+
enable-cache: true
28+
- name: Set up Python 3.13
29+
run: uv python install 3.13
30+
31+
- name: Install python dependencies
32+
run: uv sync --all-extras --prerelease=allow
33+
34+
- name: Checking formatting with ruff
35+
run: uv run ruff check
36+
37+
- name: Type check with mypy
38+
run: uv run mypy .
39+
40+
- name: Export env
41+
run: |
42+
. ./scripts/export_env.sh
43+
printenv >> $GITHUB_ENV
44+
45+
- name: Deploy skale manager
46+
run: |
47+
export ETH_PRIVATE_KEY=$(cat helper-scripts/private_key.txt)
48+
bash helper-scripts/deploy_manager.sh
49+
50+
- name: Run tests
51+
run: bash scripts/run_tests.sh
52+
53+
- name: Codecov
54+
run: |
55+
uv run codecov -t $CODECOV_TOKEN

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,8 @@ dmypy.json
130130

131131
# Editors
132132
.vscode/
133-
.idea/
133+
.idea/
134+
135+
uv.lock
136+
skale_node_data/
137+
skale_vol/

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
FROM python:3.11-bookworm
2-
3-
RUN apt update && apt install build-essential libssl-dev swig --yes
1+
FROM python:3.13.9-slim-trixie AS builder
42

3+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
54

65
RUN mkdir /usr/src/bounty
76
WORKDIR /usr/src/bounty
87

8+
COPY pyproject.toml ./
9+
RUN uv pip install --prerelease=allow --system --no-cache .
10+
11+
FROM python:3.13.8-slim-trixie
12+
13+
WORKDIR /usr/src/admin
14+
15+
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
16+
COPY --from=builder /usr/local/bin /usr/local/bin
917
COPY . .
1018

11-
RUN pip3 install --no-cache-dir -r requirements.txt
12-
RUN pip3 install --no-cache-dir -r requirements-dev.txt
1319

1420
ENV PYTHONPATH="/usr/src/bounty"
1521
CMD [ "python3", "bounty_agent.py" ]

README.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Test](https://github.com/skalenetwork/bounty-agent/workflows/Test/badge.svg)
22
![Build and publish](https://github.com/skalenetwork/bounty-agent/workflows/Build%20and%20publish/badge.svg)
33
[![codecov](https://codecov.io/gh/skalenetwork/bounty-agent/branch/develop/graph/badge.svg)](https://codecov.io/gh/skalenetwork/bounty-agent)
4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/84747976cadf49958eacbb48e7597f08)](https://www.codacy.com/gh/skalenetwork/bounty-agent?utm_source=github.com&utm_medium=referral&utm_content=skalenetwork/bounty-agent&utm_campaign=Badge_Grade)
4+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/84747976cadf49958eacbb48e7597f08)](https://www.codacy.com/gh/skalenetwork/bounty-agent?utm_source=github.com\&utm_medium=referral\&utm_content=skalenetwork/bounty-agent\&utm_campaign=Badge_Grade)
55
[![Discord](https://img.shields.io/discord/534485763354787851.svg)](https://discord.gg/vvUtWJB)
66

77
# SKALE Bounty Agent
@@ -20,39 +20,54 @@ Bounty Agent is still in active development and therefore should be regarded as
2020

2121
### Requirements
2222

23-
Python ≥ 3.6.5
23+
Python ≥ 3.13
2424

25-
### Install Dependencies
25+
### Dependencies
26+
27+
Install `uv`:
2628

2729
```bash
28-
pip install -r requirements.txt
29-
pip install -r requirements-dev.txt
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
3031
```
3132

32-
### Run tests locally
33+
Install all dependencies:
34+
35+
```bash
36+
uv sync --prerelease=allow --all-extras
37+
```
3338

34-
#### Requirements for tests
39+
### Linting and type checking
3540

36-
You have to change the name of `.env_template` file to `.env` and fill it out with your environment variables.
37-
Then run:
41+
#### Check linting/formatting issues
3842

3943
```bash
40-
bash ./scripts/create_environment.sh
44+
uv run ruff check
4145
```
4246

43-
The script above:
44-
1) runs MySQL docker container with required database and tables created
45-
2) runs Ganache docker container and deploys SKALE Manager contracts to it
46-
Then run following script to create and enable a test validator and to make some additional preparations for tests:
47+
#### Check type issues
4748

4849
```bash
49-
python tests/prepare_validator.py
50+
uv run mypy .
5051
```
5152

52-
#### Run tests
53+
### Run tests locally
54+
55+
1. Export environment variables:
5356

5457
```bash
55-
py.test -v tests/
58+
. ./scripts/export_env.sh
59+
```
60+
61+
2. Deploy skale-manager:
62+
63+
```bash
64+
bash helper-scripts/deploy_manager.sh
65+
```
66+
67+
3. Run tests:
68+
69+
```bash
70+
bash ./scripts/run_tests.sh
5671
```
5772

5873
### Build
@@ -63,15 +78,11 @@ For building Bounty agent docker image locally:
6378
docker build -t your-bounty-image-name .
6479
```
6580

66-
## Documentation
67-
68-
_in process_
69-
7081
## For more information
7182

72-
- [SKALE Network Website](https://skale.network)
73-
- [SKALE Network Twitter](https://twitter.com/SkaleNetwork)
74-
- [SKALE Network Blog](https://skale.network/blog)
83+
* [SKALE Network Website](https://skale.space)
84+
* [SKALE Network Twitter](https://twitter.com/SkaleNetwork)
85+
* [SKALE Network Blog](https://skale.space/blog)
7586

7687
Learn more about the SKALE community over on [Discord](http://skale.chat).
7788

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)