From d25a5910a02607e5d4c57859fe1f42b4758a1aaa Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Wed, 21 Jun 2023 09:03:33 +0200 Subject: [PATCH 1/9] Use newer ESPAsyncTCP library --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 0a10f16..44be5c4 100644 --- a/library.json +++ b/library.json @@ -17,9 +17,9 @@ "platforms": ["espressif8266", "espressif32"], "dependencies": [ { - "owner": "ottowinter", + "owner": "esphome", "name": "ESPAsyncTCP-esphome", - "version": "^1.2.2", + "version": "^2.0.0", "platforms": "espressif8266" }, { From 241f917b7364519685451b29494cd5c370c81c94 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Thu, 22 Jun 2023 18:56:14 +0200 Subject: [PATCH 2/9] Add Github Actions --- .github/scripts/install-platformio.sh | 133 ++++++++++++++++++++++++++ .github/scripts/on-push.sh | 20 ++++ .github/stale.yml | 31 ++++++ .github/workflows/push.yml | 30 ++++++ .travis.yml | 20 ---- 5 files changed, 214 insertions(+), 20 deletions(-) create mode 100644 .github/scripts/install-platformio.sh create mode 100755 .github/scripts/on-push.sh create mode 100644 .github/stale.yml create mode 100644 .github/workflows/push.yml delete mode 100644 .travis.yml diff --git a/.github/scripts/install-platformio.sh b/.github/scripts/install-platformio.sh new file mode 100644 index 0000000..61c94fe --- /dev/null +++ b/.github/scripts/install-platformio.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +echo "Installing Python Wheel ..." +pip install wheel > /dev/null 2>&1 + +echo "Installing PlatformIO ..." +pip install -U platformio > /dev/null 2>&1 + +echo "PlatformIO has been installed" +echo "" + + +function build_pio_sketch(){ # build_pio_sketch + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketch " + return 1 + fi + + local board="$1" + local sketch="$2" + local sketch_dir=$(dirname "$sketch") + echo "" + echo "Compiling '"$(basename "$sketch")"' ..." + python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv" +} + +function count_sketches() # count_sketches +{ + local examples="$1" + rm -rf sketches.txt + if [ ! -d "$examples" ]; then + touch sketches.txt + return 0 + fi + local sketches=$(find $examples -name *.ino) + local sketchnum=0 + for sketch in $sketches; do + local sketchdir=$(dirname $sketch) + local sketchdirname=$(basename $sketchdir) + local sketchname=$(basename $sketch) + if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then + continue + fi; + if [[ -f "$sketchdir/.test.skip" ]]; then + continue + fi + echo $sketch >> sketches.txt + sketchnum=$(($sketchnum + 1)) + done + return $sketchnum +} + +function build_pio_sketches() # build_pio_sketches +{ + if [ "$#" -lt 2 ]; then + echo "ERROR: Illegal number of parameters" + echo "USAGE: build_pio_sketches [ ]" + return 1 + fi + + local board=$1 + local examples=$2 + local chunk_idex=$3 + local chunks_num=$4 + + if [ "$#" -lt 4 ]; then + chunk_idex="0" + chunks_num="1" + fi + + if [ "$chunks_num" -le 0 ]; then + echo "ERROR: Chunks count must be positive number" + return 1 + fi + if [ "$chunk_idex" -ge "$chunks_num" ]; then + echo "ERROR: Chunk index must be less than chunks count" + return 1 + fi + + set +e + count_sketches "$examples" + local sketchcount=$? + set -e + local sketches=$(cat sketches.txt) + rm -rf sketches.txt + + local chunk_size=$(( $sketchcount / $chunks_num )) + local all_chunks=$(( $chunks_num * $chunk_size )) + if [ "$all_chunks" -lt "$sketchcount" ]; then + chunk_size=$(( $chunk_size + 1 )) + fi + + local start_index=$(( $chunk_idex * $chunk_size )) + if [ "$sketchcount" -le "$start_index" ]; then + echo "Skipping job" + return 0 + fi + + local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size )) + if [ "$end_index" -gt "$sketchcount" ]; then + end_index=$sketchcount + fi + + local start_num=$(( $start_index + 1 )) + echo "Found $sketchcount Sketches"; + echo "Chunk Count : $chunks_num" + echo "Chunk Size : $chunk_size" + echo "Start Sketch: $start_num" + echo "End Sketch : $end_index" + + local sketchnum=0 + for sketch in $sketches; do + local sketchdir=$(dirname $sketch) + local sketchdirname=$(basename $sketchdir) + local sketchname=$(basename $sketch) + if [ "${sketchdirname}.ino" != "$sketchname" ] \ + || [ -f "$sketchdir/.test.skip" ]; then + continue + fi + sketchnum=$(($sketchnum + 1)) + if [ "$sketchnum" -le "$start_index" ] \ + || [ "$sketchnum" -gt "$end_index" ]; then + continue + fi + build_pio_sketch "$board" "$sketch" + local result=$? + if [ $result -ne 0 ]; then + return $result + fi + done + return 0 +} diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh new file mode 100755 index 0000000..66f3024 --- /dev/null +++ b/.github/scripts/on-push.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +if [ ! -z "$TRAVIS_BUILD_DIR" ]; then + export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR" + export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG" +elif [ -z "$GITHUB_WORKSPACE" ]; then + export GITHUB_WORKSPACE="$PWD" + export GITHUB_REPOSITORY="esphome/async-mqtt-client" +fi + +# PlatformIO Test +source ./.github/scripts/install-platformio.sh + +echo "Installing ESPAsyncTCP ..." +python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install + +build_pio_sketches "esp12e" "$GITHUB_WORKSPACE/examples/FullyFeatured-ESP8266" +build_pio_sketches "esp32dev" "$GITHUB_WORKSPACE/examples/FullyFeatured-ESP32" diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..ce7a8e3 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,31 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +daysUntilStale: 60 +daysUntilClose: 14 +limitPerRun: 30 +staleLabel: stale +exemptLabels: + - pinned + - security + - "to be implemented" + - "for reference" + - "move to PR" + - "enhancement" + +only: issues +onlyLabels: [] +exemptProjects: false +exemptMilestones: false +exemptAssignees: false + +markComment: > + [STALE_SET] This issue has been automatically marked as stale because it has not had + recent activity. It will be closed in 14 days if no further activity occurs. Thank you + for your contributions. + +unmarkComment: > + [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. + +closeComment: > + [STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..cb3f4a7 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,30 @@ +name: ESP Async TCP CI + +on: + push: + branches: + pull_request: + +jobs: + + build-pio: + name: PlatformIO on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install PlatformIO Core + run: pip install --upgrade platformio + - name: Build Tests + run: bash ./.github/scripts/on-push.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f5d3766..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: python -python: - - "2.7" - -cache: - directories: - - "~/.platformio" - -env: - - PLATFORMIO_CI_SRC=examples/FullyFeatured-ESP8266 PLATFORMIO_CI_EXTRA_ARGS="--board=esp01 --board=nodemcuv2" - - PLATFORMIO_CI_SRC=examples/FullyFeatured-ESP32 PLATFORMIO_CI_EXTRA_ARGS="--board=lolin32" - - CPPLINT=true - -install: - - pip install -U https://github.com/platformio/platformio-core/archive/develop.zip - - pip install -U cpplint - - platformio lib -g install file://. - -script: - - if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci $PLATFORMIO_CI_EXTRA_ARGS; fi From 8d9cd8a624db70d66901a7788ba2421c6e08c6f7 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Tue, 1 Aug 2023 09:05:58 +0200 Subject: [PATCH 3/9] Update version and git url --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 44be5c4..affe2c1 100644 --- a/library.json +++ b/library.json @@ -10,9 +10,9 @@ "repository": { "type": "git", - "url": "https://github.com/OttoWinter/async-mqtt-client.git" + "url": "https://github.com/HeMan/async-mqtt-client.git" }, - "version": "0.8.6", + "version": "1.0.0", "frameworks": "arduino", "platforms": ["espressif8266", "espressif32"], "dependencies": [ From 68b0b939727b4829bc542aa078e448fe9b84fbf3 Mon Sep 17 00:00:00 2001 From: Scott Kilau Date: Sun, 27 Aug 2023 20:18:52 -0500 Subject: [PATCH 4/9] RP2040: Add support for the RP2040. --- src/AsyncMqttClient.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/AsyncMqttClient.hpp b/src/AsyncMqttClient.hpp index 4f41210..91ed5d4 100644 --- a/src/AsyncMqttClient.hpp +++ b/src/AsyncMqttClient.hpp @@ -10,6 +10,8 @@ #include #elif defined(ESP8266) #include +#elif defined(USE_RP2040) +#include #else #error Platform not supported #endif @@ -44,6 +46,9 @@ #elif defined(ESP8266) #define SEMAPHORE_TAKE(X) void() #define SEMAPHORE_GIVE() void() +#elif defined(USE_RP2040) +#define SEMAPHORE_TAKE(X) void() +#define SEMAPHORE_GIVE() void() #endif class AsyncMqttClient { From 19d020cb6303a903b4aa4aa62df9a5816d57d833 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Mon, 28 Aug 2023 21:56:14 +0200 Subject: [PATCH 5/9] Fix the build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a549cc2..cd7ebe4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Async MQTT client for ESP8266 and ESP32 ============================= -[![Build Status](https://img.shields.io/travis/marvinroger/async-mqtt-client/master.svg?style=flat-square)](https://travis-ci.org/marvinroger/async-mqtt-client) +[![Build Status](https://github.com/HeMan/async-mqtt-client/actions/workflows/push.yml/badge.svg) A maintained fork of the [AsyncMQTTClient](https://github.com/marvinroger/async-mqtt-client) library by [@marvinroger](https://github.com/marvinroger) for [ESPHome](https://esphome.io). From b9547b28af22d9acd7c66353919b96f5081a6f0b Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Mon, 28 Aug 2023 21:56:14 +0200 Subject: [PATCH 6/9] Fix the build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd7ebe4..512f0d0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Async MQTT client for ESP8266 and ESP32 ============================= -[![Build Status](https://github.com/HeMan/async-mqtt-client/actions/workflows/push.yml/badge.svg) +[![Build Status](https://github.com/HeMan/async-mqtt-client/actions/workflows/push.yml/badge.svg)](https://github.com/HeMan/async-mqtt-client/actions/workflows/push.yml) A maintained fork of the [AsyncMQTTClient](https://github.com/marvinroger/async-mqtt-client) library by [@marvinroger](https://github.com/marvinroger) for [ESPHome](https://esphome.io). From cc716378a4a86ca0a35dafc60f7ce315605ac4b6 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Tue, 29 Aug 2023 09:44:29 +0200 Subject: [PATCH 7/9] Correct name in workflow --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cb3f4a7..29bbe0f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,4 @@ -name: ESP Async TCP CI +name: Async MQTT client CI on: push: From 6dc862c6330bc3405a78f2529bf7d5464a8e16d4 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Fri, 1 Sep 2023 07:59:12 +0200 Subject: [PATCH 8/9] Bump version and add rp2040 as platform --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index affe2c1..9e92acf 100644 --- a/library.json +++ b/library.json @@ -12,9 +12,9 @@ "type": "git", "url": "https://github.com/HeMan/async-mqtt-client.git" }, - "version": "1.0.0", + "version": "1.1.0", "frameworks": "arduino", - "platforms": ["espressif8266", "espressif32"], + "platforms": ["espressif8266", "espressif32","rp2040"], "dependencies": [ { "owner": "esphome", From 569f6cb10f12e47b350ba0c348de518a0a1d0650 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Fri, 1 Sep 2023 09:00:11 +0200 Subject: [PATCH 9/9] Use newer AsyncTCP-esphome --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 9e92acf..afc9233 100644 --- a/library.json +++ b/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/HeMan/async-mqtt-client.git" }, - "version": "1.1.0", + "version": "1.1.1", "frameworks": "arduino", "platforms": ["espressif8266", "espressif32","rp2040"], "dependencies": [ @@ -25,7 +25,7 @@ { "owner": "esphome", "name": "AsyncTCP-esphome", - "version": "^1.1.1", + "version": "^2.0.1", "platforms": "espressif32" } ]