Skip to content

ci: bump actions, and ruff version. Use action #704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025
Merged
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
34 changes: 16 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.4.4"
version: "0.6.11"
enable-cache: true
- run: uvx [email protected] check .

ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
- name: Lint
uses: astral-sh/ruff-action@v3
with:
version: "0.4.4"
enable-cache: true
- run: uvx [email protected] format . --check
args: "check --fix"
- name: Format
uses: astral-sh/ruff-action@v3
with:
args: "format --check --diff"

test:
needs: [ruff, ruff-format]
needs: [ruff]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -65,12 +61,14 @@ jobs:
- name: Start minikube's loadbalancer tunnel
run: minikube tunnel &> /dev/null &
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
uses: astral-sh/setup-uv@v5
with:
version: "latest"
enable-cache: true
- name: Install Python
run: uv python install $PYTHON_VERSION
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install project
run: uv sync --all-extras --dev
- name: Run tests
Expand Down
8 changes: 4 additions & 4 deletions docs/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ Refer to the `uv` documentation for installation methods: https://docs.astral.sh
With `uv` installed you can add/remove dependencies using `uv add <dep>` or `uv remove <dep>.
This will update the [`uv.lock`](https://docs.astral.sh/uv/guides/projects/#uvlock) file automatically.

We use ruff version 0.6.8 in this project currently. This can be installed as a stand-alone binary (see documentation), or via `uv` using:
We use ruff version 0.11.0 in this project currently. This can be installed as a stand-alone binary (see documentation), or via `uv` using:

```bash
# install
$ uv tool install ruff@0.6.8
$ uv tool install ruff@0.11.0

# lint
$ uvx ruff@0.6.8 check .
$ uvx ruff@0.11.0 check .

# format
$ uvx ruff@0.6.8 format .
$ uvx ruff@0.11.0 format .
```

## Release process
Expand Down
12 changes: 6 additions & 6 deletions resources/plugins/hello/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):

hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)

assert hook_value in {
item.value for item in HookValue
}, f"{hook_value} is not a valid HookValue"
assert hook_value in {item.value for item in HookValue}, (
f"{hook_value} is not a valid HookValue"
)

if warnet_content.get(PLUGIN_ANNEX):
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
assert annex_member in {
item.value for item in AnnexMember
}, f"{annex_member} is not a valid AnnexMember"
assert annex_member in {item.value for item in AnnexMember}, (
f"{annex_member} is not a valid AnnexMember"
)

warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)

Expand Down
12 changes: 6 additions & 6 deletions resources/plugins/simln/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):

hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)

assert hook_value in {
item.value for item in HookValue
}, f"{hook_value} is not a valid HookValue"
assert hook_value in {item.value for item in HookValue}, (
f"{hook_value} is not a valid HookValue"
)

if warnet_content.get(PLUGIN_ANNEX):
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
assert annex_member in {
item.value for item in AnnexMember
}, f"{annex_member} is not a valid AnnexMember"
assert annex_member in {item.value for item in AnnexMember}, (
f"{annex_member} is not a valid AnnexMember"
)

warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)

Expand Down
6 changes: 3 additions & 3 deletions resources/scenarios/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import tempfile
import threading
from time import sleep
from typing import Dict

from kubernetes import client, config
from ln_framework.ln import LND

from test_framework.authproxy import AuthServiceProxy
from test_framework.p2p import NetworkThread
from test_framework.test_framework import (
Expand Down Expand Up @@ -160,8 +160,8 @@ def setup(self):
self.log.addHandler(ch)

# Keep a separate index of tanks by pod name
self.tanks: Dict[str, TestNode] = {}
self.lns: Dict[str, LND] = {}
self.tanks: dict[str, TestNode] = {}
self.lns: dict[str, LND] = {}
self.channels = WARNET["channels"]

for i, tank in enumerate(WARNET["tanks"]):
Expand Down
12 changes: 6 additions & 6 deletions resources/scenarios/ln_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ def open_channel(self, ch, fee_rate):
block_height = block["height"]
for ch in channels:
assert ch["id"]["block"] == block_height, f"Actual block:{block_height}\n{ch}"
assert (
block_txs[ch["id"]["index"]] == ch["txid"]
), f"Actual txid:{block_txs[ch["id"]["index"]]}\n{ch}"
assert block_txs[ch["id"]["index"]] == ch["txid"], (
f"Actual txid:{block_txs[ch['id']['index']]}\n{ch}"
)
self.log.info("👍")

gen(5)
Expand Down Expand Up @@ -294,9 +294,9 @@ def ln_all_chs(self, ln):
def update_policy(self, ln, txid_hex, policy, capacity):
self.log.info(f"Sending update from {ln.name} for channel with outpoint: {txid_hex}:0")
res = ln.update(txid_hex, policy, capacity)
assert (
len(res["failed_updates"]) == 0
), f" Failed updates: {res["failed_updates"]}\n txid: {txid_hex}\n policy:{policy}"
assert len(res["failed_updates"]) == 0, (
f" Failed updates: {res['failed_updates']}\n txid: {txid_hex}\n policy:{policy}"
)

update_threads = []
for ch in self.channels:
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
required-version = "==0.6.8"
required-version = ">=0.11"
extend-exclude = [
"resources/scenarios/test_framework",
"resources/images/exporter/authproxy.py",
Expand Down
3 changes: 2 additions & 1 deletion src/warnet/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
from typing import Optional

import click
from urllib3.exceptions import MaxRetryError

from test_framework.messages import ser_uint256
from test_framework.p2p import MESSAGEMAP
from urllib3.exceptions import MaxRetryError

from .constants import BITCOINCORE_CONTAINER
from .k8s import get_default_namespace_or, get_mission, pod_log
Expand Down
6 changes: 3 additions & 3 deletions test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def _print_and_assert_msgs(self, message):
self.log_msg_assertions_passed = True

def assert_log_msgs(self):
assert (
self.log_msg_assertions_passed
), f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
assert self.log_msg_assertions_passed, (
f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
)
self.log_msg_assertions_passed = False

def warnet(self, cmd):
Expand Down
Loading