Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/ifx_package_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
SUB_ARCHES: ${{ env.SUB_ARCHES }}
# URL of the latest ci-builds index for this branch, if any
CI_BUILDS_URL: ${{ env.CI_BUILDS_URL }}
# Subset of ALL_BOARD_DATA for boards that have a tests/test_config.h
# block (i.e. arduino-core-tests/Unity pin config is ready for them)
ARDUINO_CORE_TESTS_BOARDS: ${{ env.ARDUINO_CORE_TESTS_BOARDS }}
steps:

- name: Install OS dependencies
Expand Down Expand Up @@ -120,6 +123,24 @@ jobs:
echo "ARTIFACTS=$(jq -c '["zephyr"] + (map(.artifact) | unique)' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV"
echo "SUB_ARCHES=$(jq -c 'map(.subarch) | unique' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV"

- name: Discover boards with arduino-core-tests (Unity) config
# Cross-references tests/test_config.h's "#if defined(ARDUINO_<BOARD>)"
# blocks against boards.txt's "<board>.build.board=<BOARD>" field, so
# test-arduino-core-tests only runs for boards that actually have pin
# config ready. A no-op (empty list) on branches without tests/test_config.h.
run: |
BOARDS="[]"
if [ -f tests/test_config.h ] ; then
for DEFINE in $(grep -oP 'ARDUINO_\K[A-Z0-9_]+' tests/test_config.h | sort -u) ; do
BOARD_ID=$(grep -E "^[a-zA-Z0-9_]+\.build\.board=${DEFINE}$" boards.txt | cut -d. -f1)
[ -z "$BOARD_ID" ] && continue
ENTRY=$(jq -c --arg b "$BOARD_ID" '.[] | select(.board==$b)' <<< "${ALL_BOARD_DATA}")
[ -z "$ENTRY" ] && continue
BOARDS=$(jq -c --argjson e "${ENTRY}" '. + [$e]' <<< "${BOARDS}")
done
fi
echo "ARDUINO_CORE_TESTS_BOARDS=${BOARDS}" >> "$GITHUB_ENV"

- name: Cache west modules and blobs
uses: actions/cache@v5
with:
Expand Down Expand Up @@ -580,6 +601,61 @@ jobs:



# Compile-only check for the arduino-core-tests (Unity) suite vendored at
# tests/arduino_core_tests. Only runs for boards with a tests/test_config.h
# block (see build-env's "Discover boards with arduino-core-tests" step).
# No hardware is available in CI, so this only validates that each enabled
# test still compiles+links against the current source, it does not flash
# or run anything on real hardware.

test-arduino-core-tests:
name: Compile arduino-core-tests for ${{ matrix.board }}:${{ matrix.link_mode }}
runs-on: ubuntu-latest
needs:
- build-env
if: ${{ !cancelled() && needs.build-env.result == 'success' && needs.build-env.outputs.ARDUINO_CORE_TESTS_BOARDS != '[]' }}
strategy:
matrix:
include: ${{ fromJSON( needs.build-env.outputs.ARDUINO_CORE_TESTS_BOARDS ) }}
link_mode: [static, dynamic]
fail-fast: false
env:
FQBN: arduino:${{ matrix.subarch }}:${{ matrix.board }}:link_mode=${{ matrix.link_mode }}
CI_BUILDS_URL: ${{ needs.build-env.outputs.CI_BUILDS_URL }}
# Tests enumerated here are known to have their required
# TEST_PIN_*/etc. macros defined in tests/test_config.h for this board.
# Add more test_* names as tests/test_config.h gains board config for them.
ENABLED_TESTS: test_digitalio_single
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
persist-credentials: false

- uses: arduino/setup-arduino-cli@v2

- name: Install core tools, use this checkout as the platform
run: |
ADDITIONAL_URLS=()
[ -n "${CI_BUILDS_URL}" ] && ADDITIONAL_URLS=(--additional-urls "${CI_BUILDS_URL}")
arduino-cli core update-index "${ADDITIONAL_URLS[@]}"
arduino-cli core install "arduino:${{ matrix.subarch }}" "${ADDITIONAL_URLS[@]}"
# replace the installed hardware files with this checkout, same as
# local development does (see tests/README.md)
VERSION_DIR=$(ls -d ~/.arduino15/packages/arduino/hardware/${{ matrix.subarch }}/*/ | head -1)
rm -rf "${VERSION_DIR}"
ln -s "${GITHUB_WORKSPACE}" "${VERSION_DIR%/}"

- name: Compile enabled tests
run: |
for TEST in ${ENABLED_TESTS}; do
UPPER=$(echo "${TEST}" | tr '[:lower:]' '[:upper:]')
make -C tests/arduino_core_tests FQBN=${FQBN} UNITY_PATH=Unity \
TESTS=-D${UPPER} prepare_test_environment compile
done



# Collect all build and test reports, analyze them and produce a summary.
# See ci_collect_data.py and ci_generate_report.py for details.

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/arduino_core_tests"]
path = tests/arduino_core_tests
url = https://github.com/Infineon/arduino-core-tests.git
1 change: 1 addition & 0 deletions tests/arduino_core_tests
Submodule arduino_core_tests added at 0f52c0
28 changes: 28 additions & 0 deletions tests/test_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) Infineon Technologies AG
*
* SPDX-License-Identifier: Apache-2.0
*
* Board-specific test pin definitions for tests/arduino_core_tests.
*
* Each board adds its own #if defined(ARDUINO_<BOARD>) block below (see
* tests/README.md). This file intentionally has no board blocks of its own:
* board-specific content belongs to the branch that owns that board.
*/
#ifndef TEST_CONFIG_H
#define TEST_CONFIG_H

/*
* Infineon KIT-PSE84-AI (PSOC Edge E84).
*
* D0 (P17_5) and D1 (P17_7) must be connected with a jumper when running
* test_digitalio_single. Both pins are exposed as digital GPIOs on the board
* expansion header and are mapped by the Arduino variant overlay
* (variants/kit_pse84_ai_pse846gps2dbzc4a_m33, digital-pin-gpios).
*/
#if defined(ARDUINO_KIT_PSE84_AI)
#define TEST_PIN_DIGITAL_IO_OUTPUT 0
#define TEST_PIN_DIGITAL_IO_INPUT 1
#endif

#endif // TEST_CONFIG_H
Loading