Skip to content

Commit

Permalink
Add ESP32 build, break out ESP8266 install for CI (earlephilhower#288)
Browse files Browse the repository at this point in the history
Re-enable ESP32 builds in CI

Fix examples which do not compile on ESP32
  • Loading branch information
earlephilhower authored Aug 8, 2020
1 parent 0f40d83 commit f8d5ccf
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 37 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pr-or-master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ jobs:
bash ./tests/common.sh
build-esp32:
name: Build ESP-32
runs-on: ubuntu-latest
strategy:
matrix:
chunk: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Build Sketches
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
BUILD_TYPE: build_esp32
BUILD_MOD: 5
BUILD_REM: ${{ matrix.chunk }}
run: |
bash ./tests/common.sh
# Run host test suite under valgrind for runtime checking of code.
host-tests:
name: Host tests
Expand Down
13 changes: 9 additions & 4 deletions examples/TalkingClockI2S/TalkingClockI2S.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// https://github.com/going-digital/Talkie/blob/master/Talkie/examples/Vocab_US_Clock/Vocab_US_Clock.ino
// Released under GPL v2

#include <ESP8266WiFi.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif

#include <time.h>
#include "AudioFileSourcePROGMEM.h"
#include "AudioGeneratorTalkie.h"
Expand Down Expand Up @@ -109,7 +114,7 @@ AudioGeneratorTalkie *talkie;
AudioOutputI2S *out;


bool getLocalTime(struct tm * info, uint32_t ms) {
bool GetLocalTime(struct tm * info, uint32_t ms) {
uint32_t count = ms / 10;
time_t now;

Expand Down Expand Up @@ -156,7 +161,7 @@ void setup()
do {
tmstruct.tm_year = 0;
Serial.printf(".");
getLocalTime(&tmstruct, 5000);
GetLocalTime(&tmstruct, 5000);
delay(100);
} while (tmstruct.tm_year < 100);

Expand All @@ -170,7 +175,7 @@ void loop()
{
struct tm tmstruct ;
tmstruct.tm_year = 0;
getLocalTime(&tmstruct, 5000);
GetLocalTime(&tmstruct, 5000);
Serial.printf("\nNow is : %d-%02d-%02d %02d:%02d:%02d\n",
tmstruct.tm_year + 1900, tmstruct.tm_mon + 1,
tmstruct.tm_mday, tmstruct.tm_hour,
Expand Down
67 changes: 34 additions & 33 deletions tests/common.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

#set -x # echo on
set -ex

function print_size_info()
{
Expand Down Expand Up @@ -93,9 +93,16 @@ function install_libraries()
function install_ide()
{
local ide_path=$1
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
wget -q -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
tar xf arduino.tar.xz
mv arduino-nightly $ide_path
export PATH="$ide_path:$PATH"
}

function install_esp8266()
{
local ide_path=$1
mkdir -p $ide_path/hardware
cd $ide_path/hardware
mkdir esp8266com
cd esp8266com
Expand All @@ -109,28 +116,33 @@ function install_ide()
git submodule init
git submodule update
python3 get.py
export PATH="$ide_path:$ide_path/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin:$PATH"
export PATH="$ide_path/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin:$PATH"
popd
# cd ..
# mkdir espressif
# cd espressif
# git clone https://github.com/espressif/arduino-esp32 esp32
# pushd esp32/tools
# git submodule init
# git submodule update
# python3 get.py
# export PATH="$ide_path:$ide_path/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin:$PATH"
# popd

}

function run_host_tests()
function install_esp32()
{
pushd host
make
make clean-objects
local ide_path=$1
sudo pip install pyserial
cd $ide_path/hardware
mkdir espressif
cd espressif
git clone https://github.com/espressif/arduino-esp32.git esp32
pushd esp32
# Set custom warnings for all builds (i.e. could add -Wextra at some point)
echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags" > platform.local.txt
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags" >> platform.local.txt
echo -e "\n----platform.local.txt----"
cat platform.local.txt
git submodule init
git submodule update
cd tools
python3 get.py
export PATH="$ide_path/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/:$PATH"
popd
}

}

function install_arduino()
{
Expand All @@ -148,10 +160,8 @@ function build_sketches_with_arduino()
{
# Compile sketches
echo -e "travis_fold:start:sketch_test"
# build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
build_sketches $HOME/arduino_ide $HOME/Arduino/libraries "-l $HOME/Arduino/libraries"
echo -e "travis_fold:end:sketch_test"

# Generate size report
echo -e "travis_fold:start:size_report"
cat size.log
Expand All @@ -168,26 +178,17 @@ fi
if [ "$BUILD_TYPE" = "build" ]; then
export BUILD_PY="hardware/esp8266com/esp8266/tools/build.py -b generic -s 4M1M -v -k "
install_arduino
install_esp8266 "$HOME/arduino_ide"
build_sketches_with_arduino
elif [ "$BUILD_TYPE" = "build_esp32" ]; then
#export BUILD_PY="hardware/espressif/esp32/tools/build.py -b esp32 -v -k "
#install_arduino
#build_sketches_with_arduino
sudo apt-get update
sudo apt-get upgrade -y python
sudo pip install --upgrade pip
sudo pip install --upgrade 'urllib3[secure]'
export ide_path=$HOME/arduino_ide
install_arduino
install_esp32 "$HOME/arduino_ide"
export ide_path=$HOME/arduino_ide
export FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
source $ide_path/hardware/espressif/esp32/.github/scripts/install-arduino-ide.sh
source $ide_path/hardware/espressif/esp32/.github/scripts/install-arduino-core-esp32.sh
build_sketches "$FQBN" "$HOME/Arduino/libraries" 0 1
elif [ "$BUILD_TYPE" = "host_tests" ]; then
# Run host side tests
cd $TRAVIS_BUILD_DIR/tests
run_host_tests
build_sketches "$FQBN" "$HOME/Arduino/libraries" "$BUILD_REM" "$BUILD_MOD"
fi

0 comments on commit f8d5ccf

Please sign in to comment.