Skip to content

Commit 21dbbce

Browse files
committed
Add Unit test + global filter feature
- Added Global Filter features - Implemented basic tests - Created test helpers for common testing utilities, including JSON generation and MQTT topic creation. - Developed integration tests for module interactions, MQTT message flow, and configuration management. - Added mock implementations for unit testing, including IStorage and RFBaseGateway. - Introduced Command actions and status returns - Added comprehensive test cases for block and pass list functionalities, including edge cases and ignore flags. - Included wildcard pattern matching tests for both pass and block lists. - Impruved Storage management and logging in core components; add NoopStorage for non-ESP32 targets Refactor logging in Filter and MessageFilter classes; improve message filtering logic in pub function feat: Implement topic filtering functionality in Filter and MessageFilter classes - Added methods to add, remove, and check for topic filters in the Filter class. - Introduced a constant for the topic filter key to optimize memory usage. - Enhanced MessageFilter to handle topic rules from incoming commands. - Implemented logic to check allowed topics based on pass and block lists. - Added comprehensive unit tests for topic filtering, including edge cases and wildcard patterns. - Updated existing tests to ensure compatibility with new filtering logic.
1 parent a79567d commit 21dbbce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+6119
-254
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: "🛠️ Build"
22

33
on: [push, pull_request]
44

.github/workflows/build_and_docs_to_dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Build binaries, docs and publish to dev folder
1+
name: 🛠️📚 Build binaries, docs and publish to dev folder
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
66
jobs:
77
build-upload:
88
runs-on: ubuntu-latest

.github/workflows/ci.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: 🚀 CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [main, development, feature/*]
6+
pull_request:
7+
branches: [main, development]
8+
9+
jobs:
10+
# Job 1: Code Formatting Check
11+
lint:
12+
name: 🔍 Check Code Format
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Check main format
17+
uses: DoozyX/clang-format-lint-action@v0.6
18+
with:
19+
source: "./main"
20+
extensions: "h,ino"
21+
clangFormatVersion: 9
22+
23+
# Job 2: Native Tests
24+
native-tests:
25+
name: 🧪 Run Native Tests
26+
runs-on: ubuntu-latest
27+
needs: lint
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.11"
33+
- name: Install PlatformIO
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install platformio
37+
- name: Run Native Tests
38+
run: pio test -e test_native
39+
- name: Test Results Summary
40+
if: always()
41+
run: |
42+
echo "Test execution completed"
43+
44+
# Job 3: Build Matrix
45+
build:
46+
name: 🛠️ Build (${{ matrix.environments }})
47+
runs-on: ubuntu-latest
48+
needs: [lint, native-tests]
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
environments:
53+
- "rfbridge"
54+
- "rfbridge-direct"
55+
- "esp32dev-all-test"
56+
- "esp32dev-rf"
57+
- "esp32dev-pilight-cc1101"
58+
- "esp32dev-somfy-cc1101"
59+
- "esp32dev-pilight-somfy-cc1101"
60+
- "esp32dev-weatherstation"
61+
- "esp32dev-gf-sun-inverter"
62+
- "esp32dev-ir"
63+
- "esp32dev-ble"
64+
- "esp32dev-ble-mqtt-undecoded"
65+
- "esp32dev-ble-aws"
66+
- "esp32feather-ble"
67+
- "esp32-lolin32lite-ble"
68+
- "esp32-olimex-gtw-ble-eth"
69+
- "esp32-olimex-gtw-ble-poe"
70+
- "esp32-olimex-gtw-ble-poe-iso"
71+
- "esp32-wt32-eth01-ble-eth"
72+
- "esp32-olimex-gtw-ble-wifi"
73+
- "esp32-m5stick-ble"
74+
- "esp32-m5stack-ble"
75+
- "esp32-m5tough-ble"
76+
- "esp32-m5stick-c-ble"
77+
- "esp32-m5stick-cp-ble"
78+
- "esp32s3-atomS3U"
79+
- "esp32-m5atom-matrix"
80+
- "esp32-m5atom-lite"
81+
- "esp32dev-rtl_433"
82+
- "esp32dev-rtl_433-fsk"
83+
- "esp32doitv1-aithinker-r01-sx1278"
84+
- "heltec-rtl_433"
85+
- "heltec-rtl_433-fsk"
86+
- "heltec-ble"
87+
- "lilygo-rtl_433"
88+
- "lilygo-rtl_433-fsk"
89+
- "lilygo-ble"
90+
- "esp32dev-multi_receiver"
91+
- "esp32dev-multi_receiver-pilight"
92+
- "tinypico-ble"
93+
- "ttgo-lora32-v1"
94+
- "ttgo-lora32-v21"
95+
- "ttgo-t-beam"
96+
- "heltec-wifi-lora-32"
97+
- "shelly-plus1"
98+
- "nodemcuv2-all-test"
99+
- "nodemcuv2-fastled-test"
100+
- "nodemcuv2-2g"
101+
- "nodemcuv2-ir"
102+
- "nodemcuv2-serial"
103+
- "avatto-bakeey-ir"
104+
- "nodemcuv2-rf"
105+
- "nodemcuv2-rf-cc1101"
106+
- "nodemcuv2-somfy-cc1101"
107+
- "manual-wifi-test"
108+
- "rf-wifi-gateway"
109+
- "nodemcuv2-rf2"
110+
- "nodemcuv2-rf2-cc1101"
111+
- "nodemcuv2-pilight"
112+
- "nodemcuv2-weatherstation"
113+
- "sonoff-basic"
114+
- "sonoff-basic-rfr3"
115+
- "esp32dev-ble-datatest"
116+
- "esp32s3-dev-c1-ble"
117+
- "esp32c3-dev-m1-ble"
118+
- "airm2m_core_esp32c3"
119+
- "esp32c3_lolin_mini"
120+
- "esp32c3-m5stamp"
121+
- "thingpulse-espgateway"
122+
- "theengs-bridge"
123+
- "esp32dev-ble-idf"
124+
- "theengs-bridge-v11"
125+
- "theengs-plug"
126+
- "esp32dev-ble-broker"
127+
- "esp32s3-m5stack-stamps3"
128+
- "esp32c3u-m5stamp"
129+
- "lilygo-t3-s3-rtl_433"
130+
- "lilygo-t3-s3-rtl_433-fsk"
131+
steps:
132+
- uses: actions/checkout@v4
133+
- name: Set up Python
134+
uses: actions/setup-python@v5
135+
with:
136+
python-version: "3.11"
137+
- name: Install platformio
138+
run: |
139+
python -m pip install --upgrade pip
140+
pip install platformio
141+
pip install setuptools
142+
- name: Extract ESP32 platform version from platformio.ini
143+
run: |
144+
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
145+
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
146+
- name: Run PlatformIO
147+
run: platformio run -e ${{ matrix.environments }}
148+
- name: Upload Assets
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: ${{ matrix.environments }}
152+
path: |
153+
.pio/build/*/firmware.bin
154+
.pio/build/*/partitions.bin
155+
retention-days: 7
156+
157+
# Job 4: Documentation
158+
documentation:
159+
name: 📚 Build Documentation
160+
runs-on: ubuntu-latest
161+
needs: lint
162+
steps:
163+
- uses: actions/checkout@v4
164+
- name: Set up Node.js
165+
uses: actions/setup-node@v4
166+
with:
167+
node-version: "14.x"
168+
- name: Download Common Config
169+
run: |
170+
curl -o docs/.vuepress/public/commonConfig.js https://www.theengs.io/commonConfig.js
171+
- name: Install build dependencies
172+
run: npm install
173+
- name: Build documentation
174+
run: npm run docs:build

.github/workflows/lint.yml

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

.github/workflows/manual_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create and publish documentation
1+
name: "📚 Create and publish documentation"
22
on:
33
workflow_dispatch:
44
workflow_call:
@@ -42,4 +42,4 @@ jobs:
4242
with:
4343
github_token: ${{ secrets.GITHUB_TOKEN }}
4444
publish_dir: ./docs/.vuepress/dist
45-
cname: docs.openmqttgateway.com
45+
cname: docs.openmqttgateway.com

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: "🚀 Release"
22

33
on:
44
release:

.github/workflows/stale.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Close inactive issues or PR
1+
name: "🗑️ Close inactive issues or PR"
2+
23
on:
34
schedule:
45
- cron: "30 0 * * *"

0 commit comments

Comments
 (0)