Sub-IoT-Stack CI #937
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sub-IoT-Stack CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 21 * * *' | |
jobs: | |
run-unit-tests: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build stack natively | |
run: | | |
mkdir build && cd build | |
platform="NATIVE" | |
cmake ../stack/ -DPLATFORM=$platform -DCMAKE_TOOLCHAIN_FILE="../stack/cmake/toolchains/gcc.cmake" -DBUILD_UNIT_TESTS=y -DFRAMEWORK_CONSOLE_ENABLED=n -DTEST_AES=y -DTEST_FEC=y -DTEST_ALP=y -DTEST_FIFO=y -DTEST_SCHEDULER=y -DMODULE_D7AP=n -DFRAMEWORK_MODEM_INTERFACE_ENABLED=n -DFRAMEWORK_USE_POWER_TRACKING=n | |
make -j | |
- name: Run unit tests | |
run: | | |
./build/tests/aes/test_aes &> results_aes.txt | |
./build/tests/alp/test_alp &> results_alp.txt | |
./build/tests/fec/test_fec &> results_fec.txt | |
./build/tests/fifo/test_fifo &> results_fifo.txt | |
./build/tests/scheduler/test_scheduler &> results_scheduler.txt | |
- name: Upload the results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: results | |
path: | | |
results_aes.txt | |
results_alp.txt | |
results_fec.txt | |
results_fifo.txt | |
results_scheduler.txt | |
- name: Handle results | |
run: | | |
if ! grep -q 'AES all unit tests OK !' "results_aes.txt"; then exit 1; fi | |
if ! grep -q 'Unit-tests for ALP completed' "results_alp.txt"; then exit 1; fi | |
if ! grep -q 'Input was decoded successfully' "results_fec.txt"; then exit 1; fi | |
if ! grep -q 'All FIFO tests passed!' "results_fifo.txt"; then exit 1; fi | |
if ! grep -q 'All scheduler tests passed!' "results_scheduler.txt"; then exit 1; fi | |
generate-builds: | |
name: Generate Builds | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up compiler | |
uses: fiam/arm-none-eabi-gcc@v1 | |
with: | |
release: '8-2018-q4' | |
- name: Build stack | |
run: | | |
mkdir build && cd build | |
platform="B_L072Z_LRWAN1" | |
cmake ../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DFRAMEWORK_DEBUG_ASSERT_REBOOT=y -DMODULE_D7AP_FS_DISABLE_PERMISSIONS=y -DAPP_MODEM_FORWARD_ALP_OVER_SERIAL=y | |
make -j | |
cd .. | |
- name: Upload the builds | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: build/ | |
run-testsuite: | |
name: Run Testsuite | |
runs-on: self-hosted | |
needs: generate-builds | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Flash builds to devices | |
run: | | |
if $(lsof -i -P -n | grep -q JLinkExe) ; then exit 1; fi | |
if pgrep -f "python3 run.py" ; then exit 1; fi | |
cd build/apps/modem | |
JLinkExe -SelectEmuBySN 770821797 -CommandFile jlink-flash-full.script > flashOutput1.txt | |
JLinkExe -SelectEmuBySN 772958091 -CommandFile jlink-flash-full.script > flashOutput2.txt | |
cat flashOutput1.txt | |
cat flashOutput2.txt | |
if grep -q 'FAILED\|ERROR' "flashOutput1.txt"; then exit 1; fi | |
if grep -q 'FAILED\|ERROR' "flashOutput2.txt"; then exit 1; fi | |
- name: Run testsuite | |
run: | | |
if $(lsof -i -P -n | grep -q JLinkExe) ; then exit 1; fi | |
if pgrep -f "python3 run.py" ; then exit 1; fi | |
rm -rf Sub-IoT-testsuite | |
git clone --recurse-submodules https://github.com/Sub-IoT/Sub-IoT-testsuite.git | |
cd Sub-IoT-testsuite | |
python3 -m pip install -r requirements.txt -r lib/pyd7a/requirements.txt | |
python3 run.py --serial-test-device=/dev/ttyUSB0 --serial-dut=/dev/ttyUSB1 -m "not band433 and not known_issue" --junitxml report.xml -v | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-results | |
path: Sub-IoT-testsuite/report.xml | |