Skip to content

Commit beb98e6

Browse files
committed
fix: Add new mock for ESP8266Wifi to allow compilation of sketch
1 parent a7b4b48 commit beb98e6

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/arduino-ci.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,28 @@ jobs:
1818
mkdir -p $GITHUB_WORKSPACE/libraries
1919
mkdir -p $GITHUB_WORKSPACE/.arduino15
2020
mkdir -p $GITHUB_WORKSPACE/Arduino
21+
mkdir -p $GITHUB_WORKSPACE/mocks # Create a directory for mock files
22+
23+
- name: Create mock ESP8266WiFi.h
24+
run: |
25+
cat > $GITHUB_WORKSPACE/mocks/ESP8266WiFi.h << 'EOF'
26+
#ifndef ESP8266WIFI_MOCK_H
27+
#define ESP8266WIFI_MOCK_H
28+
29+
#include <Arduino.h>
30+
31+
class WiFiClass {
32+
public:
33+
void begin(const char* ssid, const char* password) {}
34+
void disconnect() {}
35+
bool isConnected() { return true; }
36+
IPAddress localIP() { return IPAddress(192, 168, 1, 1); }
37+
};
38+
39+
extern WiFiClass WiFi;
40+
41+
#endif // ESP8266WIFI_MOCK_H
42+
EOF
2143
2244
- name: Setup Arduino CLI
2345
uses: arduino/setup-arduino-cli@v1
@@ -79,4 +101,6 @@ jobs:
79101
80102
- name: Run tests
81103
run: |
82-
bundle exec arduino_ci.rb
104+
# Add the mock directory to the include path
105+
export CPLUS_INCLUDE_PATH=$GITHUB_WORKSPACE/mocks:$CPLUS_INCLUDE_PATH
106+
bundle exec arduino_ci.rb

0 commit comments

Comments
 (0)