diff --git a/.github/workflows/hil-unity-checks.yml b/.github/workflows/hil-unity-checks.yml deleted file mode 100644 index 3e1aa01b..00000000 --- a/.github/workflows/hil-unity-checks.yml +++ /dev/null @@ -1,237 +0,0 @@ -name: Hil unity library checks - -# on which event should we start push, pull request or schedule dispatches -on: - - push - -env: - TEST_VERSION: 1.0.0 - -permissions: - contents: write - -# This template runes multiple workflows -jobs: - - - ############################################################################# - # This action sets common variables for the flow and - # identifies the libs to compile - setup: - - # we run this on self hosted runner, use labels to be more specific - # add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones - runs-on: - - self-hosted - - X64 - - Linux - - steps: - # checkout the latest github action code - - name: Checkout actions - uses: actions/checkout@v4 - with: - token: ${{ secrets.UNITY_TOKEN }} - submodules: recursive - - # checkout the latest arduino-cli compiler - - name: Setup Arduino CLI - uses: arduino/setup-arduino-cli@master - - # Update the arduino code. Attention this does not setup XMC packages as this are set inside the self hosted runner - # the arduino board support packages can be updated automatically - # the XMC board support package is only linked inside the self hosted runner, which allows - # to use none official and beta versions - # arduino-cli core install "infineon:xmc" - - name: Install/Update Arduino Platform - run: | - arduino-cli core update-index - arduino-cli core install "arduino:avr" - - # Fetch variables and move them to the GITHUB_OUTPUT and fetch HIL information - - id: startup - run: | - # switch on the HIL - cd /opt/runner_support/ - REPO="$(basename "$GITHUB_REPOSITORY")" - ./py_checkusb.py --switch repo --namelist $REPO --onoff on - - # set the hil-unity-checks - hil=$(./py_checkusb.py --readyaml $GITHUB_WORKSPACE/tests/hil-unity-checklist.yaml --json) - echo "hil=${hil}" >> $GITHUB_OUTPUT - - # 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}" - - # Connect the GITHUB_OUTPUT to the variables and the workflow output mechanism - outputs: - hil: ${{ steps.startup.outputs.hil }} - devices: ${{ steps.startup.outputs.devices }} - - - ############################################################################# - # This step allows HIL (Hardware in the loop), therefore - # is searches for the given board/sensor combination and tries to find the actual port - # on the self hosted runner. (see documentation for the board2port finder) - flash: - - # We need a successful build before we can run the deploy - needs: [setup] - - # we run this on self hosted runner, use labels to be more specific - # add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones - runs-on: - - self-hosted - - X64 - - Linux - - # do not stop if a single job fails - continue-on-error: true - - strategy: - - # the code to flash - matrix: - # the serials of the hardware boards - device: ${{ fromJson(needs.setup.outputs.devices) }} - - # These are the steps which should run for each combination of fqbn and lib code - steps: - # checkout the latest github action code - - name: Checkout actions - uses: actions/checkout@v4 - with: - token: ${{ secrets.UNITY_TOKEN }} - submodules: recursive - - # setup environment - - name: Environment - run: | - cd $HOME - rm -rf ~/.arduino15/packages/Infineon/hardware/xmc/* - ln -s $GITHUB_WORKSPACE ~/.arduino15/packages/Infineon/hardware/xmc/$TEST_VERSION - - hil=${{ toJson(needs.setup.outputs.hil) }} - REPO="$(basename "$GITHUB_REPOSITORY")" - DEVICE="$(basename ${{ matrix.device }} )" - LIBRARY=$(echo $hil | jq ".\"${DEVICE}\"" -r --compact-output) - FQBN=`tr '.' ':' <<<"${DEVICE}"` - - echo "repo=$REPO" >> $GITHUB_ENV - echo "device=$DEVICE" >> $GITHUB_ENV - echo "version=$TEST_VERSION" >> $GITHUB_ENV - echo "library=$LIBRARY" >> $GITHUB_ENV - echo "fqbn=$FQBN" >> $GITHUB_ENV - - echo "Repo " $REPO - echo "Device " $DEVICE - echo "Library " $LIBRARY - echo "FQBN " $FQBN - echo "Version " ${TEST_VERSION} - - # Build the test code with make and flash it to the board - # runs via nested loops: - # - first loop over the libraries mentioned for a device in the yaml file - # - selects the serial ids and ports for all devices connected with this device and library - # - second loop over the examples mentioned below the selected device for a library in the yaml file - # - third loop over the tests mentioned below the selected example for a device and library in the yaml file - # - fourth loop over the make commands mentioned below the selected test for a device, example and library in the yaml file - - - name: Build - run: | - export TMPDIR=$HOME/tmp - mkdir -p $TMPDIR - rm -rf $HOME/artefact - mkdir -p $HOME/artefact - - lib=${{ toJson(env.library) }} - readarray -t LIBS < <(echo ${lib} | jq ".|keys[]" -r --compact-output) - - # loop over all libs in the unity test yaml - for LIB in "${LIBS[@]}"; do - cd /opt/runner_support/ - readarray -t SERIALS < <(echo $(./py_checkusb.py --type ${LIB} --json) | jq ".\"${LIB}\".\"${{ env.device }}\"|keys[]" -r) - - # check if we have one or more serial numbers for this lib or stop here - if [[ -z $SERIALS ]]; then - echo "No serial or library information found" - exit 0 - fi - - # loop over all serials and fetch the ports - declare -a PORTS - for SERIAL in "${SERIALS[@]}"; do - PORTS+=($(/opt/runner_support/find_usb.sh $SERIAL)) - done - - # loop over all examples for one library - readarray -t EXAMPLES < <(echo $lib | jq ".\"${LIB}\"|keys[]" -r --compact-output) - for EXAMPLE in "${EXAMPLES[@]}"; do - echo "==============================================================================================================" - echo "Run for EXAMPLE: ${EXAMPLE} under LIB: ${LIB}" - echo "==============================================================================================================" - - # loop over all tests for one example and compile7flash the devices - readarray -t TESTS < <(echo $lib | jq ".\"${LIB}\".\"${EXAMPLE}\"[]" -r --compact-output) - for ((idx=0; idx<${#TESTS[@]}; ++idx)); do - cd $GITHUB_WORKSPACE/tests/arduino-core-tests/ - echo "==============================================================================================================" - echo "Run on index $idx for TEST: ${TESTS[idx]} under EXAMPLE: ${EXAMPLE} and LIB: ${LIB} on port: ${PORTS[idx]}" - echo "==============================================================================================================" - make FQBN=${{ env.fqbn }} PORT=${PORTS[idx]} UNITY_PATH=/opt/Unity ${TESTS[idx]} - mkdir -p ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/ - mv ./build/build/* ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/. - echo "==============================================================================================================" - done # end of TEST loop flash - - # loop over all tests for one example and monitor the serial output - for ((idx=0; idx<${#TESTS[@]}; ++idx)); do - echo "==============================================================================================================" - echo "Monitor on index $idx for TEST: ${TESTS[idx]} under EXAMPLE: ${EXAMPLE} and LIB: ${LIB}" - timeout 1m \ - /opt/runner_support/py_console.py \ - --port ${PORTS[idx]} \ - --baud 115200 \ - --report ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/${{ env.device }}/report.json - - echo "==============================================================================================================" - done # end of TEST loop monitor - - done # end of EXAMPLE loop - done # end of LIB loop - - # 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 - - - ############################################################################# - # Switch off the HIL after all tests are done - post: - - # we run this no matter if before fails - if: always() - # wait on first setup run before starting main function - needs: [setup, flash] - - # we run this on self hosted runner, use labels to be more specific - # add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones - runs-on: - - self-hosted - - X64 - - Linux - - steps: - - name: Switch off HIL - run: | - cd /opt/runner_support/ - REPO="$(basename "$GITHUB_REPOSITORY")" - ./py_checkusb.py --switch repo --namelist $REPO --onoff off - diff --git a/.github/workflows/hil_checks.yml b/.github/workflows/hil_checks.yml new file mode 100644 index 00000000..0b34ad06 --- /dev/null +++ b/.github/workflows/hil_checks.yml @@ -0,0 +1,13 @@ +name: HIL Checks + +on: + pull_request: + push: + +jobs: + makers-devops: + uses: Infineon/makers-devops/.github/workflows/hil_checks.yml@4.0.0-hil-integration + with: + project-yaml: config/project.yml + user-yaml: config/user.yml + secrets: inherit \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 442e75b4..d5a1cf7b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "arduino-core-tests"] - path = tests/arduino-core-tests + path = extras/arduino-core-tests url = https://github.com/Infineon/arduino-core-tests.git [submodule "cores/arduino-core-api"] path = extras/arduino-core-api diff --git a/config/project.yml b/config/project.yml new file mode 100644 index 00000000..aa830a15 --- /dev/null +++ b/config/project.yml @@ -0,0 +1,131 @@ +# options: +# USE_CORE: +# name: Infineon:xmc@3.5.0 +# url: https://github.com/Infineon/XMC-for-Arduino/releases/latest/download/package_infineon_index.json +options: + USE_CORE: + name: local + url: https://balabla +# # INCLUDE: + # - filename + +compile: + compile-xmc-kit_xmc47_relax: + description: Compiling test_digitalio_single.cpp for XMC platform + command: make -f Makefile.arduino.mk test_digitalio_single compile + fqbns: [infineon:xmc:kit_xmc47_relax] + working_dir: tests/arduino-core-tests + +code-quality: + source-code-quality-clang-tidy: + description: clang-tidy check sources + tool: clang-tidy + command: extras/makers-devops/src/python/code_checks/run_clang_tidy.sh ./cores/xmc/* ./libraries/* + + source-code-quality-cppcheck: + description: cppcheck check sources + tool: cppcheck + command: extras/makers-devops/src/python/code_checks/run_cppcheck.sh ./cores/xmc/* + | -I extras/arduino-core-api/api/ -I cores/xmc/xmc_lib/XMCLib/inc/ -I variants/XMC1400/config/KIT_XMC14_2GO + | -I variants/XMC1400 -I cores/xmc/avr -I cores/xmc/usblib -I cores/xmc/xmc_lib/inc + | -I /cores/xmc + | -i cores/xmc/xmc_lib/ -i cores/xmc/api/ --suppress=*:cores/xmc/xmc_lib/* + | --suppress=*:extras/arduino-core-api/api/* --suppress=*:cores/xmc/api/* + +# test-code-quality-clang-tidy: +# description: clang-tidy check tests +# tool: clang-tidy +# command: extras/makers-devops/tools/code_checks/run_clang_tidy.sh ./tests/arduino-core-tests/src/* + +# test-code-quality-cppcheck: +# description: cppcheck check tests +# tool: cppcheck +# command: extras/makers-devops/tools/code_checks/run_cppcheck.sh ./tests/arduino-core-tests/src/* +# | -I extras/arduino-core-api/api/ -I variants/CY8CKIT-062S2-AI/mtb-bsp -I extras/mtb-libs/core-lib/include +# | -I libraries/WiFi/src -I libraries/Wire/src -I libraries/SPI/src -I extras/mtb-libs/mtb-hal-cat1/include +# | -I extras/mtb-libs/wifi-connection-manager/include --suppress=*:extras/mtb-libs/wifi-connection-manager/include* +# | -I tests/arduino-core-tests/Unity/src --suppress=*:tests/arduino-core-tests/Unity/src/* +# | -I variants/CY8CKIT-062S2-AI -I cores/psoc6 --suppress=*:variants/CY8CKIT-062S2-AI/* --suppress=*:extras/mtb-libs/mtb-hal-cat1/include/* +# | --suppress=*:extras/arduino-core-api/api/* --suppress=*:cores/psoc6/api/* --suppress=*:variants/CY8CKIT-062S2-AI/mtb-bsp/* --suppress=*:extras/mtb-libs/core-lib/include/* + +# code-quality-clang-format: +# description: clang-tidy check sources +# tool: clang-format +# command: extras/makers-devops/tools/code_checks/run_clang_format.sh ./cores/psoc6/* ./libraries/* + +# code-quality-black-format: +# description: clang-tidy check sources +# tool: black-format +# command: extras/makers-devops/tools/code_checks/run_black.sh ./extras/makers-devops/tools/* + + + +unit-test: + unit-test-timer-4700: + - description: Compiling, flashing and monitoring timer unit test. + command: make test_time_single UNITY_PATH=/opt/Unity + query: time_single_board == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + unit-test-pwm-4700: + - description: Compiling, flashing and monitoring timer unit test. + command: make test_analogio_pwm UNITY_PATH=/opt/Unity + query: analogio_pwm_single_board == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + unit-test-iic-4700: + - description: Compiling, flashing and monitoring timer unit test. + command: make test_wire_connected1_pingpong UNITY_PATH=/opt/Unity + query: iic_ping_pong_single_board == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + unit-test-iic-pingpong-4700: + - description: Compiling, flashing and monitoring I2C pingpong slave unit test. + command: make test_wire_connected2_slavepingpong UNITY_PATH=/opt/Unity + query: iic_ping_pong_multiple_boards_slave == '2:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + - description: Compiling, flashing and monitoring I2C pingpong master unit test. + command: make test_wire_connected2_masterpingpong UNITY_PATH=/opt/Unity + query: iic_ping_pong_multiple_boards_master == '2:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + unit-test-uart-connected2-4700: + - description: Compiling, flashing and monitoring uart rx unit test. + command: make test_uart_rx UNITY_PATH=/opt/Unity + query: uart_multiple_boards_rx == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + - description: Compiling, flashing and monitoring uart tx unit test. + command: make test_uart_tx UNITY_PATH=/opt/Unity + query: uart_multiple_boards_tx == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + unit-test-iic-pingpong-1400: + - description: Compiling, flashing and monitoring I2C pingpong slave unit test. + command: make test_wire_connected2_slavepingpong UNITY_PATH=/opt/Unity + query: iic_ping_pong_multiple_boards_slave == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True + + - description: Compiling, flashing and monitoring I2C pingpong master unit test. + command: make test_wire_connected2_masterpingpong UNITY_PATH=/opt/Unity + query: iic_ping_pong_multiple_boards_master == '1:1' + working_dir: extras/arduino-core-tests + options: + SEND_JOB_START_TOKEN: True \ No newline at end of file diff --git a/config/user.yml b/config/user.yml new file mode 100644 index 00000000..18627521 --- /dev/null +++ b/config/user.yml @@ -0,0 +1,19 @@ +# code-quality: +# - source-code-quality-clang-tidy +# - source-code-quality-cppcheck +# - test-code-quality-clang-tidy +# - test-code-quality-cppcheck +# - code-quality-clang-format +# - code-quality-black-format + +# compile: +# - compile-psoc6-cy8ckit_062s2_ai + + +unit-test: + - unit-test-iic-pingpong-4700 + - unit-test-iic-4700 +# - unit-test-uart-connected2-4700 + - unit-test-timer-4700 + - unit-test-pwm-4700 +# - unit-test-iic-pingpong-1400 \ No newline at end of file diff --git a/extras/arduino-core-tests b/extras/arduino-core-tests new file mode 160000 index 00000000..e07abd07 --- /dev/null +++ b/extras/arduino-core-tests @@ -0,0 +1 @@ +Subproject commit e07abd07747572225f8c0cb7368cff2faa1237ec diff --git a/extras/arduino-devops b/extras/arduino-devops index 267471c7..6c5339a9 160000 --- a/extras/arduino-devops +++ b/extras/arduino-devops @@ -1 +1 @@ -Subproject commit 267471c79da2e7da81759d27b519da3507b5a563 +Subproject commit 6c5339a95fe79563b21f546507b5e99ff28d6333 diff --git a/extras/makers-devops b/extras/makers-devops index 377170f8..827cd7e3 160000 --- a/extras/makers-devops +++ b/extras/makers-devops @@ -1 +1 @@ -Subproject commit 377170f8456d9ee4c7836fb39ee25776ab66f446 +Subproject commit 827cd7e3d70725ff6bdc086ad773aa0a9d0327f1 diff --git a/tests/arduino-core-tests b/tests/arduino-core-tests deleted file mode 160000 index 7723c484..00000000 --- a/tests/arduino-core-tests +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7723c4848b1557ac12cf8611a8157c44ebf3c5c8