Skip to content

Default arduino_ci configuration may test platforms/architectures that, according to library.properties, are unsupported #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
feilipu opened this issue Dec 8, 2020 · 11 comments · Fixed by #14

Comments

@feilipu
Copy link

feilipu commented Dec 8, 2020

My library uses standard avr-libc headers provided by the Arduino IDE normally, and the lack of these headers is breaking the CI workflow.

fatal error: avr/io.h: No such file or directory
fatal error: avr/wdt.h: No such file or directory
fatal error: util/atomic.h: No such file or directory

How can I add appropriate scripting to ensure they're provided?

Also, independently, I need to prevent the workflow from attempting to compile against the ESP8266, as it is AVR only library.
How can that be done?

Error during build: Error resolving FQBN: getting build properties for board esp8266:esp8266:huzzah: invalid option 'FlashSize'
@feilipu feilipu changed the title How to use standard avrlibc headers? How to use standard avr-libc headers? Dec 8, 2020
@ianfixes
Copy link
Contributor

Hi @feilipu! Sorry for my delayed reply, I got the email but thought that you had opened this against the project that underlies this github action (https://github.com/Arduino-CI/arduino_ci/issues)

I will move these issues there. The short answer(s) here are that avr/wdt.h hasn't been mocked out in my library yet. (Although io.h should be...)

As far as the espressif board problems, I that discussion is spread over a few projects and I'll link them.

I can respond more fully in a bit but I wanted to acknowledge that I saw this.

@feilipu
Copy link
Author

feilipu commented Dec 13, 2020

Thanks Ian.

I need this set to be included at least as headers.

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/wdt.h>

@ianfixes
Copy link
Contributor

Looking again at the build log, it appears that the error (printed below) is coming from the "backend", which is the arduino-cli binary:

Last command:  $  /usr/local/bin/arduino-cli --format json compile --fqbn arduino:sam:arduino_due_x --warnings all --dry-run /github/home/Arduino/libraries/FreeRTOS/examples/AnalogRead_DigitalRead/AnalogRead_DigitalRead.ino
In file included from /github/home/Arduino/libraries/FreeRTOS/src/Arduino_FreeRTOS.h:57:0,
                 from /github/home/Arduino/libraries/FreeRTOS/examples/AnalogRead_DigitalRead/AnalogRead_DigitalRead.ino:1:
/github/home/Arduino/libraries/FreeRTOS/src/FreeRTOSConfig.h:30:20: fatal error: avr/io.h: No such file or directory
 #include <avr/io.h>

If this builds in the Arduino IDE but not with arduino-cli, it might be a bug in arduino-cli. @per1234 am I correct in asserting that? I believe I am properly installing sam board support so I don't know what else to check here.

@per1234
Copy link

per1234 commented Dec 14, 2020

avr/io.h is AVR-specific. You won't be able to compile any program that uses this for a non-AVR board. So this is the normal and expected error.

I see the library specifies that it is only for the AVR archtecture. So I think the problem here is that Arduino CI has not been configured to only compile for AVR.

@per1234
Copy link

per1234 commented Dec 14, 2020

Arduino CI has not been configured to only compile for AVR.

By this, I mean the problem is the lack of .arduino-ci.yml in the feilipu/Arduino_FreeRTOS_Library, not that there is a problem with Arduino CI.

See this section of the documentation:
https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md#control-how-examples-are-compiled

@ianfixes
Copy link
Contributor

Aah OK -- so the issue is that (presumably) this library was only ever meant for AVR but Arduino CI's default behavior of also testing sam boards is where things go astray.

@feilipu as a new user, can you discuss some ways that the software might have reported that to you in a more actionable way? For example, is it surprising to you that your library doesn't work on non-AVR architecture? Or is the surprise that arduino_ci attempted to run tests on those architectures in the first place? Should I attempt to parse the error message and warn you about the architecture problems and/or suggest modifying the config? (I'm concerned that doing so might be brittle, but a cryptic error message is also bad).

@feilipu
Copy link
Author

feilipu commented Dec 14, 2020

@ianfixes I've simply followed the instructions as noted on the Arduino Developers' Google Group to try to get CI working. The action on failure was pretty clear; just raise an issue, as I've done. So nothing to improve there. Perhaps if this is not the right place to raise the issue, then correct the links to enable others to do better.

The library itself is specifically and only for AVR ATmega architecture, and it is reported as such in its properties file.

I wasn't aware that additional files, such as a .arduino-ci.yml mentioned by @per1234 , are necessary. They weren't mentioned in the instruction on Arduino Developers' Group. If they need to be added, then I'll need help to get them right. Some of the examples in the examples folder require additional libraries or Board Description code, for example, and these should also be excluded from the CI flow if it is too complex to make work easily.

@ianfixes
Copy link
Contributor

I've simply followed the instructions as noted on the Arduino Developers' Google Group

Thank you for taking the time to try it out, and even more so for taking the time to describe your experience here.

The library itself is specifically and only for AVR ATmega architecture, and it is reported as such in its properties file.

Aah! That's something I should be reading and reacting to. Opened Arduino-CI/arduino_ci#246

I wasn't aware that additional files, such as a .arduino-ci.yml mentioned by @per1234 , are necessary. They weren't mentioned in the instruction on Arduino Developers' Group.

This is a valuable signal to me that I don't have the right documentation in the right places. I'm very curious what documentation of mine that you encountered while setting up & using arduino_ci. (At the very least, I see that my comments here are insufficient: https://github.com/marketplace/actions/arduino_ci#testing-different-arduino-platforms )

Opened #12

Some of the examples in the examples folder require additional libraries or Board Description code, for example, and these should also be excluded from the CI flow if it is too complex to make work easily.

This is straightforward. But if you'll indulge me, I'm wondering if you could attempt to find it in the docs and let me know if it's not easy to find. You're right that it's entirely possible for an example within a library to include dependencies beyond the library itself, and so I support that use case directly.

@ianfixes
Copy link
Contributor

If you'd like to try this in an experimental branch, including the action as - uses: Arduino-CI/action@latest should fix this. I have that and other fixes in Arduino-CI/arduino_ci#256

@ianfixes ianfixes changed the title How to use standard avr-libc headers? Default arduino_ci configuration may test platforms/architectures that, according to library.properties, are unsupported Dec 31, 2020
@feilipu
Copy link
Author

feilipu commented Jan 9, 2021

I've revised the workflow file, and there is a new issue with the ruby gems solution.

Not sure if this is transient, or something more important.

Default config, platforms matching architectures in library.properties... 
    uno
    leonardo
    trinket
    gemma
    mega2560
    cplayClassic
...Default config, platforms matching architectures in library.properties       
Board package arduino:avr has a defined URL...                                 ✓
Installing board package arduino:avr...                                        ✓
Board package adafruit:avr has a defined URL...                                ✓
Installing board package adafruit:avr...                                       ✓
bundler: failed to load command: /action/bundle/ruby/2.6.0/bin/arduino_ci.rb (/action/bundle/ruby/2.6.0/bin/arduino_ci.rb)
NoMethodError: undefined method `[]' for nil:NilClass

@ianfixes
Copy link
Contributor

ianfixes commented Jan 9, 2021

Looks like the failure is here https://github.com/Arduino-CI/arduino_ci/blob/master/exe/arduino_ci.rb#L483

I'm somewhat confused, because we did a lot of testing on this branch. But I'll have to dig into it tomorrow. Can you open a new issue with this info? This bug is different than the one you reported initially.

In the meantime, I have a development branch that you can try by changing .github/workflows/arduino_test_runner.yml

      steps:
        - uses: actions/checkout@v2
-       - uses: Arduino-CI/[email protected]   # v0.1.2 or the latest version
+       - uses: Arduino-CI/action@latest  # development branch, in flux

Any changes I try out would hit that branch first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants