Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
pull_request:

jobs:
media-port:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install dependencies
run: pip install -r requirements.txt

- name: Start status-backend
run: docker compose up -d --build

- name: Wait for backend health
run: |
for i in $(seq 1 60); do
if curl -fsS http://127.0.0.1:8080/health >/dev/null; then
exit 0
fi
sleep 5
done
echo "backend did not become healthy in time"
docker compose logs
exit 1

- name: Run media server port test
run: pytest tests/test_media_server_port.py -v

- name: Dump backend logs on failure
if: failure()
run: docker compose logs

- name: Stop containers
if: always()
run: docker compose down
23 changes: 18 additions & 5 deletions bot/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Account:
}
__ETH_ADDRESS = "0x0000000000000000000000000000000000000000"

def __init__(self, domain: str = "localhost", port: int = 8080, is_secure: bool = False, backup_folder: Optional[str] = None):
def __init__(self, domain: str = "localhost", port: int = 8080, is_secure: bool = False, backup_folder: Optional[str] = None, media_port: int = 8081):
"""
Work with your own Status App account

Expand All @@ -42,7 +42,10 @@ def __init__(self, domain: str = "localhost", port: int = 8080, is_secure: bool
- `port` - the port to connect to Status Backend. Verify the port in the Docker files.
- `is_secure` - if `http` or `https` should be used
- `backup_folder` - where backup files will be created and stored
- `media_port` - fixed media server port (advertized in localUrl as domain:media_port)
"""
self.__domain = domain
self.__media_port = media_port
# Wallet transactions
self.__alchemy_token = None
self.__transactions: Optional[pd.DataFrame] = None
Expand Down Expand Up @@ -103,6 +106,14 @@ def __init__(self, domain: str = "localhost", port: int = 8080, is_secure: bool
# In case if there is a hanging logged in session
self.logout()

def __initialize_application_payload(self) -> dict:
return {
"dataDir": self.__docker_data_folder,
"mediaServerAddress": f"0.0.0.0:{self.__media_port}",
"mediaServerAdvertizeHost": self.__domain,
"mediaServerAdvertizePort": self.__media_port,
}

def login(self, password: str, key_uid: Optional[str] = None, name: Optional[str] = None, mnemonic: Optional[str] = None, infura_token: Optional[str] = None, alchemy_token: Optional[str] = None, coingecko_api_key: Optional[str] = None):
"""
Login to the given account. If it does not exist,
Expand Down Expand Up @@ -252,9 +263,10 @@ def available_accounts(self) -> list[dict]:
"""
All locally available accounts
"""
response = requests.post(self.__urls["http"]["initialize"], json={
"dataDir": self.__docker_data_folder
})
response = requests.post(
self.__urls["http"]["initialize"],
json=self.__initialize_application_payload(),
)
data: dict = response.json()
accounts: list[dict] = data.get("accounts", [])
if not isinstance(accounts, list):
Expand Down Expand Up @@ -1323,7 +1335,8 @@ def __start_messenger(self):
return
self.logger.info("Starting messaging")
self.__call_rpc("messaging", "startMessenger")
self.__signal.get("wakuv2.peerstats")
with self.__signal.expect("waku.connection.status.change", timeout=60):
pass
self.__is_messenger_launched = True
self.logger.info("Messaging launched")

Expand Down
7 changes: 5 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ services:
backend:
build:
context: https://github.com/status-im/status-go.git#develop
platform: linux/amd64
container_name: status-backend
ports:
- 8080:8080
- 8081:8081
- 8545:8545
- 30303:30303
entrypoint: 'status-backend'
Expand All @@ -16,7 +16,10 @@ services:
networks:
- status-bridge
healthcheck:
test: ["CMD", "curl http://0.0.0.0:8080/health"]
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8080/health || exit 1"]
interval: 10s
timeout: 5s
retries: 30

networks:
status-bridge:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ websockets
pandas
pillow
eth-abi
pytest
Loading
Loading