Skip to content

Commit

Permalink
Use GitHub CI to run tests (earlephilhower#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
earlephilhower authored Aug 8, 2020
1 parent 3349459 commit 0f40d83
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 38 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pr-or-master-push.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Binary file added examples/PlayAACFromPROGMEM/homer.aac
Binary file not shown.
16 changes: 11 additions & 5 deletions tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
6 changes: 4 additions & 2 deletions tests/host/aac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Empty file added tests/host/pgmspace.h
Empty file.
Binary file added tests/host/test_8u_16.wav
Binary file not shown.
1 change: 0 additions & 1 deletion tests/host/wav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0f40d83

Please sign in to comment.