diff --git a/.github/workflows/hil_checks.yml b/.github/workflows/hil_checks.yml new file mode 100644 index 00000000..d2f0610e --- /dev/null +++ b/.github/workflows/hil_checks.yml @@ -0,0 +1,13 @@ +name: Hil Checks + +on: + push: + +jobs: + makers-devops: + uses: Infineon/makers-devops/.github/workflows/hil_checks.yml@main + with: + project-yaml: config/project.yml + user-yaml: config/user.yml + secrets: inherit + \ No newline at end of file diff --git a/.github/workflows/hil_unity_checks.yml b/.github/workflows/hil_unity_checks.yml deleted file mode 100644 index 81842cc2..00000000 --- a/.github/workflows/hil_unity_checks.yml +++ /dev/null @@ -1,162 +0,0 @@ -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:psoc6:cy8ckit_062s2_ai" - ] - - # include additional information for each fqbn, in this case the platform name to install - include: - - fqbn: "infineon:psoc6:cy8ckit_062s2_ai" - platform: "infineon:psoc6" - - # 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/psoc6 - rm -rf * - - - name: copy/link repository to arduino path - run: | - mkdir ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION - cp -a ./* ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION - cd ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION - - - name: copy/link arduino core api path - run: | - bash ./tools/dev-setup.sh - mkdir ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION/cores/psoc6/api - cp -a ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION/extras/arduino-core-api/api/* ~/.arduino15/packages/infineon/hardware/psoc6/$TEST_VERSION/cores/psoc6/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/psoc6/$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/psoc6/$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 \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 64febfba..8cf76c2c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule "extras/mtb-libs/retarget-io"] path = extras/mtb-libs/retarget-io url = https://github.com/Infineon/retarget-io.git -[submodule "tests/arduino-core-tests"] - path = tests/arduino-core-tests - url = https://github.com/Infineon/arduino-core-tests.git [submodule "extras/mtb-libs/abstraction-rtos"] path = extras/mtb-libs/abstraction-rtos url = https://github.com/Infineon/abstraction-rtos.git @@ -76,3 +73,9 @@ [submodule "extras/makers-devops"] path = extras/makers-devops url = https://github.com/Infineon/makers-devops.git +[submodule "extras/arduino-core-tests"] + path = extras/arduino-core-tests + url = https://github.com/Infineon/arduino-core-tests.git +[submodule "extras/arduino-devops"] + path = extras/arduino-devops + url = https://github.com/Infineon/arduino-devops.git diff --git a/README.md b/README.md index 2d4b4225..91eb67c9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![compile examples](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/compile_examples.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/compile_examples.yml) -[![HIL test](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/hil_unity_checks.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/hil_unity_checks.yml) +[![HIL test](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/hil_checks.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/hil_unity_checks.yml) [![code format check](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/code_formatting.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/code_formatting.yml) [![code spell check](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/codespell.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/codespell.yml) [![commit message check](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/commit_formatting.yml/badge.svg)](https://github.com/Infineon/arduino-core-psoc6/actions/workflows/commit_formatting.yml) diff --git a/config/project.yml b/config/project.yml new file mode 100644 index 00000000..7277ff27 --- /dev/null +++ b/config/project.yml @@ -0,0 +1,121 @@ +options: + USE_CORE: + name: local + url: http://blabla + SEND_JOB_START_TOKEN: true + # INCLUDE: + # - filename + +compile: + compile-psoc6-cy8ckit_062s2_ai: + description: Compiling test_digitalio_single.cpp for PSOC6 platform + command: make -f Makefile.arduino.mk test_digitalio_single compile + fqbns: [infineon:psoc6:cy8ckit_062s2_ai] + 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/tools/code_checks/run_clang_tidy.sh ./cores/psoc6/* ./libraries/* + + source-code-quality-cppcheck: + description: cppcheck check sources + tool: cppcheck + command: extras/makers-devops/tools/code_checks/run_cppcheck.sh ./cores/psoc6/* ./libraries/* + | -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 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/* + + 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-digital-io: + - description: Compiling, flashing and monitoring digital IO unit test. + command: make test_digitalio_single + query: digital_io_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-tone: + - description: Compiling, flashing and monitoring tone, no-tone unit test. + command: make test_digitalio_single + query: tone_no_tone_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-interrupts: + - description: Compiling, flashing and monitoring Interrupts unit test. + command: make test_interrupts_single + query: interrupts_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-random: + - description: Compiling, flashing and monitoring random unit test. + command: make test_random + query: random_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-time: + - description: Compiling, flashing and monitoring Time unit test. + command: make test_time_single + query: time_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-iic-pingpong: + - description: Compiling, flashing and monitoring I2C pingpong slave unit test. + command: make test_wire_connected2_slavepingpong + query: iic_ping_pong_multiple_boards_slave == '1:1' + working_dir: extras/arduino-core-tests + + - description: Compiling, flashing and monitoring I2C pingpong master unit test. + command: make test_wire_connected2_masterpingpong + query: iic_ping_pong_multiple_boards_master == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-spi-pingpong: + - description: Compiling, flashing and monitoring SPI pingpong slave unit test. + command: make test_spi_connected2_slavepingpong + query: spi_ping_pong_multiple_boards_slave == '1:1' + working_dir: extras/arduino-core-tests + + - description: Compiling, flashing and monitoring SPI pingpong master unit test. + command: make test_spi_connected2_masterpingpong + query: spi_ping_pong_multiple_boards_master == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-spi-loopback: + - description: Compiling, flashing and monitoring SPI loopback unit test. + command: make test_spi_connected1_loopback + query: spi_ping_pong_single_board == '1:1' + working_dir: extras/arduino-core-tests + + unit-test-iic-single-board: + - description: Compiling, flashing and monitoring I2C single board unit test. + command: make test_wire_connected1_pingpong + query: iic_ping_pong_single_board == '1:1' + working_dir: extras/arduino-core-tests \ No newline at end of file diff --git a/config/user.yml b/config/user.yml new file mode 100644 index 00000000..94bec289 --- /dev/null +++ b/config/user.yml @@ -0,0 +1,10 @@ +unit-test: + - unit-test-iic-pingpong + - unit-test-spi-pingpong + - unit-test-digital-io + - unit-test-interrupts + - unit-test-time + - unit-test-random + - unit-test-tone + - unit-test-spi-loopback + - unit-test-iic-single-board diff --git a/extras/arduino-core-tests b/extras/arduino-core-tests new file mode 160000 index 00000000..a7150643 --- /dev/null +++ b/extras/arduino-core-tests @@ -0,0 +1 @@ +Subproject commit a715064340444c58d53e522da9549db39cc2bac6 diff --git a/extras/arduino-devops b/extras/arduino-devops new file mode 160000 index 00000000..6c5339a9 --- /dev/null +++ b/extras/arduino-devops @@ -0,0 +1 @@ +Subproject commit 6c5339a95fe79563b21f546507b5e99ff28d6333 diff --git a/extras/makers-devops b/extras/makers-devops index a6cf4f91..2bfb5f35 160000 --- a/extras/makers-devops +++ b/extras/makers-devops @@ -1 +1 @@ -Subproject commit a6cf4f91a8f110d6931b8d7614ded625cd40aa66 +Subproject commit 2bfb5f35ac2fe0e61bb571ef302e060eb238aebc diff --git a/tests/test_config.h b/extras/test_config.h similarity index 100% rename from tests/test_config.h rename to extras/test_config.h diff --git a/tests/arduino-core-tests b/tests/arduino-core-tests deleted file mode 160000 index 7a8d9a42..00000000 --- a/tests/arduino-core-tests +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7a8d9a422d0463c66628316e02c314f3badae5c0 diff --git a/tools/dev-setup.sh b/tools/dev-setup.sh index 26a823ad..55f961e1 100644 --- a/tools/dev-setup.sh +++ b/tools/dev-setup.sh @@ -7,7 +7,7 @@ echo ${PWD} function git_submodule_setup { echo "Setting up Git Submodules..." git submodule init - git submodule update --recursive + git submodule update --init --recursive } function core_api_setup {