Skip to content

Commit

Permalink
chore: Update library version to 1.3.0 and add compile_errors.log to …
Browse files Browse the repository at this point in the history
….gitignore
  • Loading branch information
RobertByrnes committed Jul 15, 2024
1 parent 1ee33c0 commit 495e456
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/arduino_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Arduino Examples

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install Arduino CLI
uses: arduino/setup-arduino-cli@v2

- name: Install Arduino Cores
run: |
arduino-cli config init
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli core install esp32:esp32
- name: Install libs
run: |
arduino-cli lib install "Ethernet"
arduino-cli lib install "GovoroxSSLClient"
arduino-cli lib install "WiFi"
arduino-cli lib install "ArduinoHttpClient"
arduino-cli lib install "PubSubClient"
arduino-cli lib install "TinyGSM"
- name: Compile Examples
run: |
./.github/workflows/scripts/compile_arduino_examples.sh --clean
4 changes: 2 additions & 2 deletions .github/workflows/pio_examples.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test PlatformIO Examples
name: Build PlatformIO Examples

on: [push, pull_request]

Expand All @@ -22,4 +22,4 @@ jobs:
- name: Compile Examples
run: |
./.github/workflows/scripts/compile-examples.sh --clean
./.github/workflows/scripts/compile_pio_examples.sh --clean
97 changes: 97 additions & 0 deletions .github/workflows/scripts/compile_arduino_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/bash

# Set the root directory containing the example directories
ROOT_DIR=$(pwd)
CLEAN=false

# Boards to test
BOARDS=("arduino:avr:uno" "esp32:esp32:esp32doit-devkit-v1" "esp32:esp32:esp32wroverkit")

# Parse command line options
while [[ "$#" -gt 0 ]]; do
case $1 in
--clean) CLEAN=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done

# Initialize results array
declare -A RESULTS

# Function to compile the example for a specific board
compile_example() {
local example_dir=$1
local board=$2
local example_name
example_name=$(basename "$example_dir")
echo "Compiling example in directory: $example_dir for board: $board"

# Change to the example directory
cd "$example_dir" || exit 1

# Compile the example using arduino-cli
arduino-cli compile --fqbn "$board" . || {
echo "Compilation failed for $example_dir for board: $board" >> "$ROOT_DIR/compile_errors.log"
RESULTS["$example_name,$board"]="Failed"
return 1
}

echo "Compilation successful for $example_dir for board: $board"
RESULTS["$example_name,$board"]="Passed"
}

# Function to clean the example
clean_example() {
local example_dir=$1
echo "Cleaning example in directory: $example_dir"

# Change to the example directory
cd "$example_dir" || exit 1

# Clean the example using arduino-cli
arduino-cli cache clean || {
echo "Cleaning failed for $example_dir"
return 1
}

echo "Cleaning successful for $example_dir"

# Remove build directory if --clean option is passed
if [ "$CLEAN" = true ]; then
echo "Removing build directory in $example_dir"
rm -rf build
fi

# Return to the root directory
cd "$ROOT_DIR" || exit 1
}

# Remove previous log file
rm -f "$ROOT_DIR/compile_errors.log"

# Iterate over each example directory
for example_dir in "$ROOT_DIR"/examples/Esp32-Arduino-IDE/*/; do
echo "$example_dir"
# Check if the directory contains a .ino file
if [ -f "$example_dir"/*.ino ]; then
for board in "${BOARDS[@]}"; do
compile_example "$example_dir" "$board"
done

# Clean the example after all board-specific compilations are complete
clean_example "$example_dir"
else
echo "Skipping directory $example_dir (no .ino file found)"
fi
done

# Generate summary
echo "Compilation Summary:"
echo "===================="
for key in "${!RESULTS[@]}"; do
IFS=',' read -r example_name board <<< "$key"
echo "Example: $example_name, Board: $board, Result: ${RESULTS[$key]}"
done

echo "All examples processed. Check compile_errors.log for any compilation errors."
25 changes: 25 additions & 0 deletions .github/workflows/scripts/install_sslclient_for_testing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/bash

# Remove existing SSLClient directory to avoid conflicts
rm -rf ~/SSLClient

# Clone the repository
git clone https://github.com/govorox/SSLClient.git ~/SSLClient
cd ~/SSLClient

# Checkout the desired branch
git checkout v1.3.0 # Use the correct branch name if different

# Ensure correct structure
mkdir -p SSLClient # Create the directory for the library files
mv LICENSE README.md docs examples library.json library.properties platformio.ini src test SSLClient/

# Compress the directory
zip -r SSLClient.zip SSLClient

# Enable unsafe installs in Arduino CLI configuration
mkdir -p ~/.arduino15
echo -e "library:\n enable_unsafe_install: true" > ~/.arduino15/arduino-cli.yaml

# Install the library using Arduino CLI
arduino-cli lib install --config-file ~/.arduino15/arduino-cli.yaml --zip-path SSLClient.zip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.vscode/
lib/*
test.log
emulation.log
emulation.log
compile_errors.log
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SSLClient",
"version": "1.2.0",
"version": "1.3.0",
"repository":
{
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GovoroxSSLClient
version=1.2.0
version=1.3.0
author=V Govorovski
maintainer=Robert Byrnes <[email protected]>
sentence=Provides secure network connection over a generic Client transport object.
Expand Down

0 comments on commit 495e456

Please sign in to comment.