Add ESP32 build, break out ESP8266 install for CI (#288)

Re-enable ESP32 builds in CI

Fix examples which do not compile on ESP32
This commit is contained in:
Earle F. Philhower, III authored and GitHub committed 2020-08-08 16:40:21 -07:00
1 parent 0f40d83241
commit f8d5ccf7d0
3 files changed
+66 -37

No files matched your search

+23
View File
@@ -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
+9 -4
View File
@@ -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"
@@ -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;
@@ -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);
@@ -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,
+34 -33
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#set -x # echo on
set -ex
function print_size_info()
{
@@ -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
@@ -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()
{
@@ -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
@@ -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