Seeed-Studio / ArduinoCore-mbed

3 stars 6 forks source link

Adjust "Compile Examples" workflow for Seeed boards #6

Closed per1234 closed 2 years ago

per1234 commented 2 years ago

The "Compile Examples" GitHub Actions workflow compiles example sketches of the platform bundled libraries for each of the platform's boards on every push, pull request, and periodically. This provides a basic "smoke test" for the platform.

The workflow originated from the "Arduino Mbed OS Boards" platform, and thus was configured to compile for those boards. It must be reconfigured here to install the correct toolchain and compile for Seeed Studio's boards of the platform.

I see that all the original Arduino boards definitions are still in the platform, but I'm assuming you will eventually remove those so I have also removed their compilations from the workflow.


Notes

Seeed XIAO nRF52840 Sense

The job is failing due to this error while installing the platform:

Running command: /home/runner/bin/arduino-cli core install --additional-urls https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json Seeeduino:nrf52 

[...]

  Installing platform Seeeduino:nrf52@2.5.2...
  Error during install: Cannot install platform: installing platform Seeeduino:nrf52@2.5.2: searching package root dir: no unique root dir in archive, found '/home/runner/.arduino15/tmp/package-994337494/bootloaders' and '/home/runner/.arduino15/tmp/package-994337494/cores'

This is a valid failure caused by an invalid structure of the platform archive file: https://files.seeedstudio.com/arduino/core/nRF52840/Seeed_XIAO_BLE_nRF52840_Sense.tar.bz2 Learn about the required structure of the archive here: https://arduino.github.io/arduino-cli/latest/package_index_json-specification/#installation-archive-structure

You can reproduce the issue locally with Arduino CLI by running this command:

arduino-cli core install --additional-urls https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json Seeeduino:nrf52 

WIO_RP2040_MINI_DEV_BOARD and SEEED_XIAO_RP2040

Compilation for these boards is failing due to the following error:

Error during build: fork/exec /bin/arm-none-eabi-g++: no such file or directory

Line 63 of the workflow was intended to install the toolchain for these boards:

                name: "Seeeduino:rp2040"

It looks like this is actually a completely different platform, thus the error. However, I did not see any other RP2040 platform in the Seeed Studio package index, so I was not able to resolve the issue.

My intention here was more to provide you with a starting place you can work from to finally achieve the CI configuration you need, since I don't have enough information about this project to be able to do that for you.

Sketch selection

You should review the configuration of which sketches are compiled for the boards (sketch-paths input of the arduino/compile-sketches action) because this determines the coverage of the project.

You are not limited to the sketches contained in this repository. You can install additional libraries and standalone sketches as needed. There is an example of that practice here:

https://github.com/arduino/ArduinoCore-megaavr/blob/master/.github/workflows/compile-examples.yml

Make sure to update the workflow for the additional whenever you add new libraries or boards. It will only compile the sketches under the defined paths, so if you forget to do that then you will not have any coverage of the newly added sketches.

Package index caching

I had an odd problem where the workflow was failing due to getting an outdated version of https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json, even though I could see the new version by visiting that page in my browser. The up to date version took some hours to become available. I'm not sure what caused that (perhaps CDN caching or caching in the GitHub Actions system?), but it might cause you confusion while making changes to the package index and so I thought I would mention it.

References


Resolves https://github.com/arduino/ArduinoCore-mbed/issues/380

per1234 commented 2 years ago

From your comment here: https://github.com/arduino/ArduinoCore-mbed/issues/380#issuecomment-1007085463

this project does not need to support the rp2040 board, It is just for support to the nRF52840 board at moment,

@0hotpotman0 would you like me to remove the compilations for the RP2040-based boards from the workflow?

per1234 commented 2 years ago

Ah, I see now you are doing your own thing https://github.com/Seeed-Studio/ArduinoCore-mbed/commit/5da3f4bf40557763ba3ca4edececa0367ef8bbb0 so I'll close this and leave you to it.

I do recommend that you spend some time studying the GitHub Actions workflow syntax documentation: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions