diff --git a/.github/workflows/pr-or-master-push.yml b/.github/workflows/pr-or-master-push.yml new file mode 100644 index 0000000..025c461 --- /dev/null +++ b/.github/workflows/pr-or-master-push.yml @@ -0,0 +1,65 @@ +# Run whenever a PR is generated or updated. + +# Most jobs check out the code, ensure Python3 is installed, and for build +# tests the ESP8266 toolchain is cached when possible to speed up execution. + +name: ESP8266 Arduino CI + +on: + push: + branches: + - master + pull_request: + +jobs: + + build-esp8266: + name: Build ESP8266 + 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 + 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 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Run host tests + env: + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_TAG: ${{ github.ref }} + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install valgrind lcov gcc-multilib g++-multilib libc6-dbg:i386 + cd ./tests/host/ + make + valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./mp3 + valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./aac + valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./wav + valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./midi + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7f9d7c9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -sudo: false -language: bash -os: linux -dist: trusty - -matrix: - include: - - env: - - BUILD_TYPE=build -# - env: -# - BUILD_TYPE=build_esp32 - -install: - -script: - - $TRAVIS_BUILD_DIR/tests/common.sh - -deploy: - -notifications: - email: - on_success: change - on_failure: change - webhooks: - urls: - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false diff --git a/README.md b/README.md index 75105c3..812d734 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ESP8266Audio - supports ESP8266 & ESP32 [![Gitter](https://badges.gitter.im/ESP8266Audio/community.svg)](https://gitter.im/ESP8266Audio/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.org/earlephilhower/ESP8266Audio.svg?branch=master)](https://travis-ci.org/earlephilhower/ESP8266Audio) +# ESP8266Audio - supports ESP8266 & ESP32 [![Gitter](https://badges.gitter.im/ESP8266Audio/community.svg)](https://gitter.im/ESP8266Audio/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) Arduino library for parsing and decoding MOD, WAV, MP3, FLAC, MIDI, AAC, and RTTL files and playing them on an I2S DAC or even using a software-simulated delta-sigma DAC with dynamic 32x-128x oversampling. ESP8266 is fully supported and most mature, but ESP32 is also mostly there with built-in DAC as well as external ones. diff --git a/examples/PlayAACFromPROGMEM/homer.aac b/examples/PlayAACFromPROGMEM/homer.aac new file mode 100644 index 0000000..0502be6 Binary files /dev/null and b/examples/PlayAACFromPROGMEM/homer.aac differ diff --git a/tests/common.sh b/tests/common.sh index c54e675..4ca7e68 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -41,12 +41,18 @@ function build_sketches() local srcpath=$2 local build_arg=$3 local build_dir=build.tmp + local build_mod=$BUILD_MOD + local build_rem=$BUILD_REM mkdir -p $build_dir local build_cmd="python3 $arduino/$BUILD_PY -p $PWD/$build_dir $build_arg " local sketches=$(find $srcpath -name *.ino) print_size_info >size.log export ARDUINO_IDE_PATH=$arduino for sketch in $sketches; do + testcnt=$(( ($testcnt + 1) % $build_mod )) + if [ $testcnt -ne $build_rem ]; then + continue # Not ours to do + fi rm -rf $build_dir/* local sketchdir=$(dirname $sketch) local sketchdirname=$(basename $sketchdir) @@ -82,11 +88,6 @@ function install_libraries() mkdir -p $HOME/Arduino/libraries cp -a $TRAVIS_BUILD_DIR $HOME/Arduino/libraries/ESP8266Audio git clone https://github.com/earlephilhower/ESP8266SAM $HOME/Arduino/libraries/ESP8266SAM - git clone https://github.com/earlephilhower/ESP8266FastROMFS $HOME/Arduino/libraries/ESP8266FastROMFS - git clone https://github.com/Gianbacchio/ESP8266_Spiram $HOME/Arduino/libraries/ESP8266_Spiram - # Following libs are not to be tested, just used. - rm -rf $HOME/Arduino/libraries/ESP8266_Spiram/examples - rm -rf $HOME/Arduino/libraries/ESP8266FastROMFS/examples } function install_ide() @@ -159,6 +160,11 @@ function build_sketches_with_arduino() set -e +if [ "$BUILD_MOD" == "" ]; then + export BUILD_MOD=1 + export BUILD_REM=0 +fi + if [ "$BUILD_TYPE" = "build" ]; then export BUILD_PY="hardware/esp8266com/esp8266/tools/build.py -b generic -s 4M1M -v -k " install_arduino diff --git a/tests/host/Makefile b/tests/host/Makefile index 345a879..2419663 100644 --- a/tests/host/Makefile +++ b/tests/host/Makefile @@ -61,6 +61,6 @@ midi: FORCE echo valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all ./midi clean: - rm -f mp3 aac wav *.o + rm -f mp3 aac wav midi *.o FORCE: diff --git a/tests/host/aac.cpp b/tests/host/aac.cpp index a9a99b9..fd7a3a0 100644 --- a/tests/host/aac.cpp +++ b/tests/host/aac.cpp @@ -3,13 +3,15 @@ #include "AudioOutputSTDIO.h" #include "AudioGeneratorAAC.h" +#define AAC "../../examples/PlayAACFromPROGMEM/homer.aac" + int main(int argc, char **argv) { (void) argc; (void) argv; - AudioFileSourceSTDIO *in = new AudioFileSourceSTDIO("jamonit.aac"); + AudioFileSourceSTDIO *in = new AudioFileSourceSTDIO(AAC); AudioOutputSTDIO *out = new AudioOutputSTDIO(); - out->SetFilename("jamonit.aac.wav"); + out->SetFilename("out.aac.wav"); void *space = malloc(28000+60000); AudioGeneratorAAC *aac = new AudioGeneratorAAC(space, 28000+60000); diff --git a/tests/host/pgmspace.h b/tests/host/pgmspace.h new file mode 100644 index 0000000..e69de29 diff --git a/tests/host/test_8u_16.wav b/tests/host/test_8u_16.wav new file mode 100644 index 0000000..b582740 Binary files /dev/null and b/tests/host/test_8u_16.wav differ diff --git a/tests/host/wav.cpp b/tests/host/wav.cpp index f428fd2..15ed3a7 100644 --- a/tests/host/wav.cpp +++ b/tests/host/wav.cpp @@ -16,7 +16,6 @@ int main(int argc, char **argv) wav->begin(in, out); while (wav->loop()) { /*noop*/ } wav->stop(); - out->stop(); delete wav; delete out;