libraries/psoc: Begin function. #376
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: Hil unity library checks | |
# on which event should we start push, pull request or schedule dispatches | |
on: | |
- push | |
- pull_request | |
env: | |
TEST_VERSION: 1.0.0 | |
jobs: | |
# The build job compiles the sample code for different boards | |
tests: | |
############################################################################# | |
# This action sets common variables for the flow and | |
# identifies the libs to compile | |
runs-on: | |
- self-hosted | |
- X64 | |
- Linux | |
- PSoC | |
# which combination of sample code and boards should run | |
# for this example of 2 sample codes and 3 boards a total of 2x3=6 runners have to work. | |
# if we have only 4 runner then these 4 are started and the last 2 are waiting until they can start | |
strategy: | |
matrix: | |
# List of all examples in the lib to compile | |
example: [ | |
examples/testSketch/testSketch.ino | |
] | |
# board packages we want to run | |
# attention the matrix spans over the fqbn not platform so that we can choose different boards | |
# this example compiles each sample code for Arduino Uno, XMC2Go and XMC4700 boards | |
fqbn: [ | |
"infineon:psoc:cy8ckit_062s2_ai" | |
] | |
# include additional information for each fqbn, in this case the platform name to install | |
include: | |
- fqbn: "infineon:psoc:cy8ckit_062s2_ai" | |
platform: "infineon:psoc" | |
# These are the steps which should run for each combination of fqbn and example code | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Checkout arduino-devops | |
uses: actions/checkout@v4 | |
with: | |
repository: Infineon/arduino-devops | |
ref: latest | |
path: arduino-devops | |
- name: Pack Arduino core | |
run: | | |
python ./arduino-devops/arduino-packager.py --no-version-check --no-previous-releases | |
- name: Install Arduino core | |
run: | | |
python ./arduino-devops/pckg-install-local.py --pckg-dir build --verbose | |
- name: Remove latest installed platform version | |
run: | | |
cd ~/.arduino15/packages/infineon/hardware/psoc | |
rm -rf * | |
- name: copy/link repository to arduino path | |
run: | | |
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION | |
cp -a ./* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION | |
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION | |
- name: copy/link arduino core api path | |
run: | | |
mkdir ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api | |
cp -a ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/extras/arduino-core-api/api/* ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/cores/psoc/api | |
# Fetch variables and move them to the GITHUB_OUTPUT and fetch HIL information | |
- id: startup | |
run: | | |
# switch on the HIL | |
cd /opt/runner_support/ | |
# set the hil-unity-checks | |
hil=$(./py_checkusb.py --readyaml ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/tests/hil-unity-checklist.yaml --json) | |
echo "hil=${hil}" >> $GITHUB_OUTPUT | |
echo "hil=${hil}" | |
# fetch unity libraries | |
readarray -t data < <(echo $hil | jq -r '.|keys[]') | |
export dev=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${data[@]}") | |
echo "devices=${dev}" >> $GITHUB_OUTPUT | |
echo "devices=${dev}" | |
# setup environment | |
- name: Environment | |
run: | | |
hil=${{ toJson(steps.startup.outputs.hil) }} | |
REPO="$(basename "$GITHUB_REPOSITORY")" | |
DEVICE=${{ steps.startup.outputs.devices }} | |
DEVICE=$(echo $DEVICE | tr -d '[]') | |
FQBN=$(echo $DEVICE | tr -d '[]') | |
DEVICE=`tr ':' '.' <<<"${DEVICE}"` | |
echo "repo=$REPO" >> $GITHUB_ENV | |
echo "device=$DEVICE" >> $GITHUB_ENV | |
echo "version=$TEST_VERSION" >> $GITHUB_ENV | |
echo "fqbn=$FQBN" >> $GITHUB_ENV | |
echo "Repo " $REPO | |
echo "Device " $DEVICE | |
echo "FQBN " $FQBN | |
echo "Version " ${TEST_VERSION} | |
- name: Build | |
run: | | |
export TMPDIR=$HOME/tmp | |
mkdir -p $TMPDIR | |
rm -rf $HOME/artefact | |
mkdir -p $HOME/artefact | |
cd ~/.arduino15/packages/infineon/hardware/psoc/$TEST_VERSION/tests/arduino-core-tests/ | |
echo "==============================================================================================================" | |
echo "Run Tests" | |
echo "==============================================================================================================" | |
make FQBN=${{ env.fqbn }} PORT=/dev/ttyACM0 test_digitalio_single | |
mkdir -p ~/artefact/unit_tests/${{ env.device }} | |
mv ./build/* ~/artefact/unit_tests/. | |
echo "==============================================================================================================" | |
echo "==============================================================================================================" | |
echo "Monitor" | |
timeout 1m \ | |
/opt/runner_support/py_console.py \ | |
--port /dev/ttyACM0 \ | |
--baud 115200 \ | |
--report ~/artefact/unit_tests/${{ env.device }}/report.json | |
echo "==============================================================================================================" | |
# Upload the compiled HEX files to the GitHub server | |
- name: Artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.device }} | |
path: ~/artefact/* | |
if-no-files-found: ignore |