Skip to content

clang

clang #153

Workflow file for this run

name: Build Examples
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
example: [SimpleGet, PostWithData, MultipleRequests, CustomHeaders, StreamingUpload, CompileTest]
platform: [esp32dev]
steps:
- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio/.cache
key: ${{ runner.os }}-pio-${{ hashFiles('examples/platformio/**/platformio.ini') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build PlatformIO example
run: |
example_name="${{ matrix.example }}"
ex_dir="examples/platformio/${example_name}"
echo "Building ${example_name} from ${ex_dir} for ${{ matrix.platform }}..."
test -f "${ex_dir}/platformio.ini" || (echo "platformio.ini missing in ${ex_dir}" && exit 1)
cd "${ex_dir}"
pio run -e ${{ matrix.platform }} -v
syntax-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Check library syntax
run: |
# Create a minimal test sketch to check library compilation
test_dir="/tmp/syntax_check"
mkdir -p "$test_dir/src"
mkdir -p "$test_dir/lib/ESPAsyncWebClient"
# Create minimal test source
cat > "$test_dir/src/main.cpp" << 'EOF'
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebClient.h>
AsyncHttpClient client;
void setup() {
Serial.begin(115200);
// Test that the library compiles without errors
client.setTimeout(5000);
client.setUserAgent("ESPAsyncWebClient/1.0");
client.setHeader("Content-Type", "application/json");
Serial.println("Syntax check passed!");
}
void loop() {
delay(1000);
}
EOF
# Copy library source
cp -r src/* "$test_dir/lib/ESPAsyncWebClient/"
# Create platformio.ini
cat > "$test_dir/platformio.ini" << 'EOF'
[platformio]
default_envs = esp32dev
[env]
framework = arduino
platform_packages =
framework-arduinoespressif32@^3
build_flags =
-DCOMPILE_TEST_ONLY
-Wall
[env:esp32dev]
platform = espressif32
board = esp32dev
lib_deps =
https://github.com/ESP32Async/AsyncTCP.git
bblanchon/ArduinoJson@^6.21.0
EOF
cd "$test_dir"
echo "Running syntax check..."
pio run
library-structure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate library structure
run: |
# Check required files exist
test -f library.json || (echo "library.json missing" && exit 1)
test -f library.properties || (echo "library.properties missing" && exit 1)
test -f README.md || (echo "README.md missing" && exit 1)
test -d src || (echo "src directory missing" && exit 1)
test -d examples || (echo "examples directory missing" && exit 1)
# Check that main headers exist
test -f src/ESPAsyncWebClient.h || (echo "Main header missing" && exit 1)
# Expected example names
expected=(SimpleGet PostWithData MultipleRequests CustomHeaders StreamingUpload CompileTest)
# Arduino examples: examples/arduino/<Name>/<Name>.ino
for name in "${expected[@]}"; do
sketch="examples/arduino/${name}/${name}.ino"
test -f "$sketch" || (echo "Arduino sketch missing: $sketch" && exit 1)
done
# PlatformIO examples: examples/platformio/<Name>/{platformio.ini, src/main.cpp}
for name in "${expected[@]}"; do
projdir="examples/platformio/${name}"
test -f "$projdir/platformio.ini" || (echo "PlatformIO config missing: $projdir/platformio.ini" && exit 1)
test -f "$projdir/src/main.cpp" || (echo "PlatformIO source missing: $projdir/src/main.cpp" && exit 1)
done
echo "Library structure validation passed!"