Skip to content

Commit

Permalink
chore: update deps and use ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed May 6, 2024
1 parent f7f2af4 commit 406bf71
Show file tree
Hide file tree
Showing 8 changed files with 944 additions and 1,231 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Code Quality Check

"on":
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format:
name: Format and Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
version: "0.4.3"
args: 'format --check'
- uses: chartboost/ruff-action@v1
with:
version: "0.4.3"
30 changes: 7 additions & 23 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish Image
run-name: Publish SocketDock ${{ inputs.tag || github.event.release.tag_name }} Image

on:
on:
release:
types: [published]

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

jobs:
publish_to_ghcr:
name: Publish image to ghcr.io
publish-image:
name: Publish Image
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || '' }}

- name: Gather image info
- name: Image info
id: info
run: |
echo "repo-owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down Expand Up @@ -76,14 +68,6 @@ jobs:
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.PLATFORMS }}

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
16 changes: 7 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
---
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v2.2.0
rev: v9.16.0
hooks:
- id: commitlint
stages: [commit-msg]
args: ["--config", ".commitlint.config.js"]
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/psf/black
rev: 23.3.0
additional_dependencies: ["@commitlint/config-conventional"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
hooks:
- id: black
- id: ruff
stages: [commit]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
stages: [commit]
2 changes: 1 addition & 1 deletion docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ services:
# parser.add_argument('--disconnect_uri')

tunnel:
image: dbluhm/agent-tunnel
image: ghcr.io/indicio-tech/agent-tunnel:latest
command: -s websocket-gateway:8765 -p 4040 -h ${AGENT_TUNNEL_HOST}
12 changes: 2 additions & 10 deletions locust/locustClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@

import time
import inspect
import json

import fcntl
import os
import requests
import signal

from websocket import create_connection
import websocket

import sys
import gevent

gevent.monkey.patch_all()
Expand Down Expand Up @@ -64,7 +57,6 @@ class InboundHTTP(metaclass=Singleton):
_self = None

def __init__(self):

app = Flask(__name__)

@app.route("/")
Expand Down Expand Up @@ -98,7 +90,7 @@ def __init__(self, host):
def startup(self):
# print("startup", file=sys.stderr)

server = InboundHTTP()
InboundHTTP()

# Give a sec for the inbound server to start
time.sleep(5) # Magic Number
Expand Down Expand Up @@ -134,7 +126,7 @@ def shutdown(self):
@stopwatch
def msg_client(self):
i = ""
if self.connected == False:
if self.connected is False:
raise Exception("Not Connected!")
self.ws.send(f"Ping! ({i})")
pass
2,069 changes: 900 additions & 1,169 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ description = "Websocket relay service for use with clustered mediators"
authors = [
"Sam Curren <[email protected]>",
"Colton Wolkins (Indicio work address) <[email protected]>",
"Micah Peltier <[email protected]>",
"Daniel Bluhm <[email protected]>",
"Micah Peltier <[email protected]>",
"Daniel Bluhm <[email protected]>",
]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8.1"
aiohttp = "^3.8.4"
aiohttp = "^3.9.4"
sanic = "^22.12.0"

[tool.poetry.group.dev.dependencies]
websocket = "^0.2.1"
black = "^22"
flake8 = "^5"
ruff = "^0.4.3"
pre-commit = "^3.2.2"

[build-system]
Expand Down
14 changes: 0 additions & 14 deletions setup.cfg

This file was deleted.

0 comments on commit 406bf71

Please sign in to comment.