From 179cd9665972cdbb0534001a2c907e693a4cabdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20F=C3=A9lizard?= Date: Sun, 24 Mar 2024 00:42:40 +0000 Subject: [PATCH] Build with both clang and gcc on GitHub --- .github/workflows/make.yml | 20 ++++++++++++++++---- README.md | 1 + src/modbus.h | 4 +--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 0f037ed..0be44d2 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -11,15 +11,27 @@ permissions: jobs: build: + runs-on: ubuntu-latest + continue-on-error: true # FIXME: remove when gcc build is passing + strategy: + fail-fast: false + matrix: + cc: [clang, gcc] + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: ${{ matrix.cc }} libbsd-dev libconfig-dev libmodbus-dev libmosquitto-dev + - name: make with ${{ matrix.cc }} + run: env CC=${{ matrix.cc }} make + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: awalsh128/cache-apt-pkgs-action@latest with: packages: clang libbsd-dev libconfig-dev libmodbus-dev libmosquitto-dev mosquitto-clients - - name: make - run: make - name: make lint - run: make lint + run: env CC=clang make lint - name: make test - run: make test + run: env CC=clang make test diff --git a/README.md b/README.md index cd1af7e..08735a5 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Would like to monitor Epever/Epsolar Tracer solar charge controllers instead? He - Blog post: https://www.splitbrain.org/blog/2023-11/03-growatt_and_home_assistant - Reading Modbus registers via Home Assistant: https://github.com/home-assistant/core/issues/94149 +- https://github.com/rspring/Esphome-Growatt ## License diff --git a/src/modbus.h b/src/modbus.h index 81f4e74..626090a 100644 --- a/src/modbus.h +++ b/src/modbus.h @@ -307,9 +307,7 @@ int query_modbus(modbus_t *ctx) { return device_metrics.read_metric_succeeded_total == 0 ? EXIT_NO_METRICS : EXIT_SUCCESS; } -static void stop_modbus_thread(void) { - modbus_close(ctx); -} +static void stop_modbus_thread(void) { modbus_close(ctx); } int start_modbus_thread(char device_or_uri[static 1]) { LOG(LOG_DEBUG, "Modbus thread running...");