Skip to content

Workflow file for this run

name: Run Tests
on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/run-tests.yml"
- "cores/**"
- "extras/**"
- "libraries/**"
- "variants/**"
- "boards.txt"
- "platform.txt"
- "test/src/**"
push:
paths:
- ".github/workflows/run-tests.yml"
- "cores/**"
- "extras/**"
- "libraries/**"
- "variants/**"
- "boards.txt"
- "platform.txt"
- "test/src/**"
- "test/*"
jobs:
compile-test:
runs-on: ubuntu-latest
permissions: {}
env:
# sketch paths to compile (recursive) for all boards
SKETCHES_REPORTS_PATH: sketches-reports
COVERAGE_DATA_PATH: extras/coverage-data/coverage.info
UNIVERSAL_SKETCH_PATHS: |
- libraries/AnalogWave
# - libraries/Arduino_CAN/examples/CANRead
# - libraries/Arduino_CAN/examples/CANWrite
# - libraries/Arduino_FreeRTOS
- libraries/EEPROM
# - libraries/RTC/examples/RTC_AutomaticExample
# - libraries/RTC/examples/RTC_PeriodicExample
# - libraries/RTC/examples/Test_RTC
- libraries/SoftwareSerial
# - libraries/WDT
strategy:
fail-fast: false
matrix:
board: [
{"fqbn": "arduino-git:mock:mock_v1"},
]
# make board type-specific customizations to the matrix jobs
include:
- board:
fqbn: "arduino-git:mock:mock_v1"
steps:
- name: Checkout repository
uses: actions/checkout@v3
# The source files are in a subfolder of the ArduinoCore-API repository, so it's not possible to clone it directly to the final destination in the core
- name: Checkout ArduinoCore-API
uses: actions/checkout@v3
with:
repository: arduino/ArduinoCore-API
path: extras/ArduinoCore-API
- name: Check if API should be compiled in the core
id: checkapi
run: |
if [[ $(grep -r api platform.txt) ]]; then echo "::set-output name=IS_API::true"; fi
- name: Install ArduinoCore-API
run: rm "$GITHUB_WORKSPACE/cores/arduino/api" && mv "$GITHUB_WORKSPACE/extras/ArduinoCore-API/api" "$GITHUB_WORKSPACE/cores/arduino"
# run: mv "$GITHUB_WORKSPACE/extras/ArduinoCore-API/api" "$GITHUB_WORKSPACE/cores/arduino"
if: steps.checkapi.outputs.IS_API == 'true'
- name: List files in core
run: tree ./
- name: Build tests
shell: bash
run: |
echo "::group::Run CMake on /test"
cmake -S "test" -B "test/build"
echo "::endgroup::"
echo "::group::Run Make on /test/build"
# make --directory="test/build"
cmake --build "test/build"
echo "::endgroup::"
- name: Run tests
shell: bash
run: |
echo "::group::Run CMake on /test"
cd "test/build"
ctest
echo "::endgroup::"
- name: List files in extras
run: tree ./extras/
- name: List files in test/build
run: tree ./test/build/
- name: Install yq
shell: bash
run: |
sudo snap install yq > /dev/null
- name: Update APT package lists
shell: bash
run: |
sudo apt-get update > /dev/null
- name: Install Valgrind
shell: bash
run: |
sudo apt-get --assume-yes install valgrind > /dev/null
- name: Run tests
shell: bash
run: |
echo "bakgrund"
valgrind --tool=memcheck --leak-check=yes --error-exitcode=1 "test/build/bin/example_test"
echo <<<"$(echo "test/build/bin/example_test" | yq eval '.[]' -)"
EXIT_STATUS=0
set +o errexit
while IFS='' read -r runtimePath && [[ -n "$runtimePath" ]]; do
echo "::group::Run $runtimePath with Valgrind"
if ! valgrind --tool=memcheck --leak-check=yes --error-exitcode=1 "$runtimePath"; then
EXIT_STATUS=1
echo "::error file=$runtimePath::While running $runtimePath"
fi
echo "::endgroup::"
# done <<<"$(echo "$RUNTIME_PATHS" | yq eval '.[]' -)"
# exit $EXIT_STATUS