Skip to content

merge

merge #36

Workflow file for this run

name: Arduino CI
on:
push:
paths:
- 'src/**'
- 'examples/**'
- 'tools/**'
- 'tests/**'
- 'platformio.ini'
- '.github/workflows/**'
pull_request:
paths:
- 'src/**'
- 'examples/**'
- 'tools/**'
- 'tests/**'
- 'platformio.ini'
- '.github/workflows/**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board: ["esp32:esp32:heltec_wifi_lora_32_V3"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: System setup
run: |
sudo add-apt-repository --yes ppa:nnstreamer/ppa
sudo apt-get update
sudo apt-get -y install cppcheck
python -m pip install pyserial
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s
echo "$PWD/bin/" >> $GITHUB_PATH
- name: Run cppcheck
run: |
cppcheck --version
cppcheck --error-exitcode=1 --std=c++20 --force src
- name: Arduino setup
run: |
# Temporarily enable debug output
set -x
arduino-cli config init
arduino-cli config set library.enable_unsafe_install true
echo "[ARDUINO SETUP] Updating the index to include the Heltec ESP32 boards"
arduino-cli core update-index --additional-urls https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/releases/download/3.0.0/package_heltec_esp32_index.json
# install the Heltec ESP32 boards
if [[ "${{ matrix.board }}" =~ "esp32:esp32:" ]]; then
echo "[ARDUINO SETUP] Installing the Heltec ESP32 board"
arduino-cli core install esp32:esp32@2.0.17 --additional-urls https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/releases/download/3.0.0/package_heltec_esp32_index.json
fi
- name: Install CDP
run: |
echo "Syncing files..."
rsync -rltv --exclude=.git --exclude=bin --exclude=docs --exclude=3D-Print-Files ${PWD}/ /tmp/CDP/ > /dev/null
echo "Creating zip..."
(cd /tmp && zip -r /tmp/cdp.zip CDP > /dev/null)
echo "Installing CDP..."
arduino-cli lib install --zip-path /tmp/cdp.zip
echo "CDP Installed."
echo
arduino-cli lib list
- name: Install CDP dependencies
run: |
echo "Installing dependencies..."
file="library.properties"
dependsvar=$(awk -F'=' '/depends/{print $2}' $file)
# read the array from the string
IFS=',' read -r -a dependencies <<< "$dependsvar"
for dep in "${dependencies[@]}"
do
echo "Installing $dep..."
if [[ "$dep" == *"github"* ]]; then
arduino-cli lib install --git-url "$dep"
elif [[ "$dep" == *".zip"* ]]; then
arduino-cli lib install --zip-path "$dep"
else
arduino-cli lib install "$dep"
fi
done
echo "Dependencies installed successfully!"
echo
arduino-cli lib list
- name: Build
run: |
echo "List of installed Arduino Cores:"
arduino-cli core list
buildExampleSketch() {
BOARD=${{ matrix.board }}
echo "Building $1/$2/$2.ino..."
arduino-cli compile -v -t -b ${{ matrix.board }} $PWD/examples/$1/$2/$2.ino > ${BOARD##*:}-$2-build.log 2>&1;
echo "Build complete."
}
buildExampleSketch Basic-Ducks DuckLink
buildExampleSketch Basic-Ducks MamaDuck
- name: Upload build log
uses: actions/upload-artifact@v3
if: always()
with:
name: build-log
path: '*.log'