Skip to content

Commit 2c4cb4b

Browse files
authored
Merge pull request openwallet-foundation#18 from dbluhm/chore/updates
Update dependencies and project tooling
2 parents f7f2af4 + 6464f51 commit 2c4cb4b

15 files changed

Lines changed: 989 additions & 1259 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code Quality Check
2+
3+
"on":
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
format:
13+
name: Format and Lint Check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: chartboost/ruff-action@v1
18+
with:
19+
version: "0.4.3"
20+
args: 'format --check'
21+
- uses: chartboost/ruff-action@v1
22+
with:
23+
version: "0.4.3"

.github/workflows/publish-image.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish Image
22
run-name: Publish SocketDock ${{ inputs.tag || github.event.release.tag_name }} Image
33

4-
on:
4+
on:
55
release:
66
types: [published]
77

@@ -27,28 +27,20 @@ env:
2727
PLATFORMS: ${{ inputs.platforms || 'linux/amd64' }}
2828

2929
jobs:
30-
publish_to_ghcr:
31-
name: Publish image to ghcr.io
30+
publish-image:
31+
name: Publish Image
3232
runs-on: ubuntu-latest
3333
steps:
34-
- name: Checkout
34+
- name: Checkout Code
3535
uses: actions/checkout@v4
3636
with:
3737
ref: ${{ inputs.ref || '' }}
3838

39-
- name: Gather image info
39+
- name: Image info
4040
id: info
4141
run: |
4242
echo "repo-owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
4343
44-
- name: Cache Docker layers
45-
uses: actions/cache@v4
46-
with:
47-
path: /tmp/.buildx-cache
48-
key: ${{ runner.os }}-buildx-${{ github.sha }}
49-
restore-keys: |
50-
${{ runner.os }}-buildx-
51-
5244
- name: Set up Docker Buildx
5345
uses: docker/setup-buildx-action@v3
5446

@@ -76,14 +68,6 @@ jobs:
7668
file: Dockerfile
7769
tags: ${{ steps.meta.outputs.tags }}
7870
labels: ${{ steps.meta.outputs.labels }}
79-
cache-from: type=local,src=/tmp/.buildx-cache
80-
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
8173
platforms: ${{ env.PLATFORMS }}
82-
83-
# Temp fix
84-
# https://github.com/docker/build-push-action/issues/252
85-
# https://github.com/moby/buildkit/issues/1896
86-
- name: Move cache
87-
run: |
88-
rm -rf /tmp/.buildx-cache
89-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.pre-commit-config.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
22
repos:
33
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
4-
rev: v2.2.0
4+
rev: v9.16.0
55
hooks:
66
- id: commitlint
77
stages: [commit-msg]
88
args: ["--config", ".commitlint.config.js"]
9-
additional_dependencies: ['@commitlint/config-conventional']
10-
- repo: https://github.com/psf/black
11-
rev: 23.3.0
9+
additional_dependencies: ["@commitlint/config-conventional"]
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.4.3
1212
hooks:
13-
- id: black
13+
- id: ruff
1414
stages: [commit]
15-
- repo: https://github.com/pycqa/flake8
16-
rev: 6.0.0
17-
hooks:
18-
- id: flake8
15+
args: [--fix, --exit-non-zero-on-fix]
16+
- id: ruff-format
1917
stages: [commit]

docker-compose-local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ services:
2323
# parser.add_argument('--disconnect_uri')
2424

2525
tunnel:
26-
image: dbluhm/agent-tunnel
26+
image: ghcr.io/indicio-tech/agent-tunnel:latest
2727
command: -s websocket-gateway:8765 -p 4040 -h ${AGENT_TUNNEL_HOST}

locust/locustClient.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,10 @@
33

44
import time
55
import inspect
6-
import json
76

8-
import fcntl
9-
import os
10-
import requests
11-
import signal
127

13-
from websocket import create_connection
148
import websocket
159

16-
import sys
1710
import gevent
1811

1912
gevent.monkey.patch_all()
@@ -64,7 +57,6 @@ class InboundHTTP(metaclass=Singleton):
6457
_self = None
6558

6659
def __init__(self):
67-
6860
app = Flask(__name__)
6961

7062
@app.route("/")
@@ -98,7 +90,7 @@ def __init__(self, host):
9890
def startup(self):
9991
# print("startup", file=sys.stderr)
10092

101-
server = InboundHTTP()
93+
InboundHTTP()
10294

10395
# Give a sec for the inbound server to start
10496
time.sleep(5) # Magic Number
@@ -134,7 +126,7 @@ def shutdown(self):
134126
@stopwatch
135127
def msg_client(self):
136128
i = ""
137-
if self.connected == False:
129+
if self.connected is False:
138130
raise Exception("Not Connected!")
139131
self.ws.send(f"Ping! ({i})")
140132
pass

poetry.lock

Lines changed: 900 additions & 1169 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,37 @@ description = "Websocket relay service for use with clustered mediators"
55
authors = [
66
"Sam Curren <telegramsam@gmail.com>",
77
"Colton Wolkins (Indicio work address) <colton@indicio.tech>",
8-
"Micah Peltier <micah@indicio.tech>",
9-
"Daniel Bluhm <dbluhm@pm.me>",
8+
"Micah Peltier <micah@indicio.tech>",
9+
"Daniel Bluhm <dbluhm@pm.me>",
1010
]
1111
readme = "README.md"
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.8.1"
15-
aiohttp = "^3.8.4"
15+
aiohttp = "^3.9.4"
1616
sanic = "^22.12.0"
1717

1818
[tool.poetry.group.dev.dependencies]
1919
websocket = "^0.2.1"
20-
black = "^22"
21-
flake8 = "^5"
20+
ruff = "^0.4.3"
2221
pre-commit = "^3.2.2"
2322

2423
[build-system]
2524
requires = ["poetry-core"]
2625
build-backend = "poetry.core.masonry.api"
26+
27+
[tool.ruff]
28+
line-length = 90
29+
extend-exclude = ["locust"]
30+
31+
[tool.ruff.lint]
32+
select = ["E", "F", "C", "D"]
33+
ignore = [
34+
# Google Python Doc Style
35+
"D203", "D204", "D213", "D215", "D400", "D401", "D404", "D406", "D407",
36+
"D408", "D409", "D413",
37+
]
38+
per-file-ignores = {"**/{tests}/*" = ["F841", "D", "E501"]}
39+
40+
[tool.ruff.format]
41+
docstring-code-format = true

setup.cfg

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

socket_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
"""Simple test client."""
2+
13
import asyncio
24
import websockets
35

46

57
async def hello():
8+
"""Connect and say hello."""
69
async with websockets.connect("ws://localhost:8765/ws") as websocket:
710
for i in range(5):
811
print(f"> Hello world! ({i})", flush=True)

socketdock/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""SocketDock."""

0 commit comments

Comments
 (0)