From 36390996e2fe1be8c81f8c883e9c93f1c761c681 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:03:40 +0100 Subject: [PATCH 1/6] chore: update LICENSE year --- LICENSE | 2 +- speeder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index e4fe93d..298ab0b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 dbrennand +Copyright (c) 2024 dbrennand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/speeder.py b/speeder.py index 7f33f6c..fbf1836 100644 --- a/speeder.py +++ b/speeder.py @@ -1,7 +1,7 @@ """ MIT License -Copyright (c) 2023 dbrennand +Copyright (c) 2024 dbrennand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From f301af4e3be89b40f66bfc60b29ae1703f6e30e9 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:20:58 +0100 Subject: [PATCH 2/6] chore: update requirements --- requirements.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1f28d53..37e399f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,9 @@ -certifi==2023.7.22 -influxdb-client==1.37.0 -loguru==0.7.0 -python-dateutil==2.8.2 +certifi==2024.7.4 +influxdb-client==1.45.0 +loguru==0.7.2 +python-dateutil==2.9.0.post0 reactivex==4.0.4 +setuptools==73.0.1 six==1.16.0 -typing_extensions==4.7.1 -urllib3==2.0.4 +typing_extensions==4.12.2 +urllib3==2.2.2 From 1e1be01590b7f179593874247766de9cc7887c39 Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:22:11 +0100 Subject: [PATCH 3/6] fix: check if `json_result` is empty refactor: correct variable name refactor: change logger types for some messages --- speeder.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/speeder.py b/speeder.py index fbf1836..c69537f 100644 --- a/speeder.py +++ b/speeder.py @@ -54,7 +54,7 @@ exit(1) else: # Create list from comma separated string of server IDs - SPEEDER_SPEEDTEST_SERVER_ID = SPEEDER_SPEEDTEST_SERVER_ID.split(",") + SPEEDER_SPEEDTEST_SERVER_IDs = SPEEDER_SPEEDTEST_SERVER_ID.split(",") # Connect to InfluxDB logger.debug( @@ -67,7 +67,7 @@ ) as client: # Run the speedtest using the librespeed/speedtest-cli on an interval while True: - for server_id in SPEEDER_SPEEDTEST_SERVER_ID: + for server_id in SPEEDER_SPEEDTEST_SERVER_IDs: logger.debug(f"Running speedtest for server ID: {server_id}.") result = subprocess.run( [ @@ -84,15 +84,18 @@ # Check if the speedtest failed if result.returncode != 0: # CLI errors go to stdout - logger.debug( + logger.error( f"Speedtest for server ID: {server_id} failed with exit code: {result.returncode}.\nError: {result.stdout}" ) else: logger.debug(f"Speedtest for server ID: {server_id} succeeded.") try: json_result = json.loads(result.stdout) + # Check if the JSON result is empty + if not json_result: + raise json.decoder.JSONDecodeError("JSON result is empty.", json_result, 0) except json.decoder.JSONDecodeError as err: - logger.debug( + logger.error( f"Failed to parse JSON results for server ID: {server_id}.\nError: {err}" ) continue From be7c9484c85671f86893d58fa4a4efbff8acaf3f Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:23:38 +0100 Subject: [PATCH 4/6] [skip ci]refactor: tags --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbb969b..8a62d1c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: tags: - - 'v*' + - '*' env: REGISTRY: ghcr.io From d22c6601394dd56aa349b04edb1f569de6b0c5ef Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:36:55 +0100 Subject: [PATCH 5/6] fix: lint with black --- speeder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/speeder.py b/speeder.py index c69537f..43b455a 100644 --- a/speeder.py +++ b/speeder.py @@ -21,6 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ + from influxdb_client.client.write_api import SYNCHRONOUS from influxdb_client import InfluxDBClient from loguru import logger @@ -93,7 +94,9 @@ json_result = json.loads(result.stdout) # Check if the JSON result is empty if not json_result: - raise json.decoder.JSONDecodeError("JSON result is empty.", json_result, 0) + raise json.decoder.JSONDecodeError( + "JSON result is empty.", json_result, 0 + ) except json.decoder.JSONDecodeError as err: logger.error( f"Failed to parse JSON results for server ID: {server_id}.\nError: {err}" From ee665e166ed5b8f35b4a8b8290dc2397fc12d21f Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:37:17 +0100 Subject: [PATCH 6/6] refactor: update build.yml --- .github/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a62d1c..1742e3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,10 +19,10 @@ jobs: packages: write steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -30,14 +30,21 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64