Arduino-CI / arduino_ci

Unit testing and Continuous Integration (CI) for Arduino libraries, from a Ruby gem
Apache License 2.0
110 stars 34 forks source link

Empty examples folder causes build to fail #324

Closed RobTillaart closed 1 year ago

RobTillaart commented 2 years ago

System

https://github.com/RobTillaart/RS485/runs/6576256743?check_suite_focus=true

================================================================================
Beginning the next phase of testing...           Compilation of example sketches
/opt/hostedtoolcache/Ruby/2.6.10/x64/lib/ruby/gems/2.6.0/gems/arduino_ci-1.3.0/lib/arduino_ci/cpp_library.rb:135:in `example_sketches': undefined method `map' for nil:NilClass (NoMethodError)
    from /opt/hostedtoolcache/Ruby/2.6.10/x64/lib/ruby/gems/2.6.0/gems/arduino_ci-1.3.0/exe/arduino_ci.rb:450:in `perform_example_compilation_tests'
    from /opt/hostedtoolcache/Ruby/2.6.10/x64/lib/ruby/gems/2.6.0/gems/arduino_ci-1.3.0/exe/arduino_ci.rb:536:in `<top (required)>'
    from /opt/hostedtoolcache/Ruby/2.6.10/x64/bin/arduino_ci.rb:23:in `load'
    from /opt/hostedtoolcache/Ruby/2.6.10/x64/bin/arduino_ci.rb:23:in `<main>'
Error: Process completed with exit code 1.

(Issue Summary / Feature Request)

While pushing a new library to github without examples, the build CI fails on "missing" examples. expected success as there are no compilation errors, or maybe better a warning "NO EXAMPLES FOUND!!!"

Arduino or Unit Test Code, Illustrating the Problem

See link above

Arduino Architecture(s) Affected

All

RobTillaart commented 2 years ago

Any idea if this will be fixed?

RobTillaart commented 2 years ago

https://github.com/Arduino-CI/arduino_ci/blob/master/exe/arduino_ci.rb

change these lines 470-476

  library_examples = cpp_library.example_sketches

  if library_examples.empty?
    handle_expectation_of_files(VAR_EXPECT_EXAMPLES, "builds", "examples", "the examples directory", cpp_library.examples_dir)
    return
  end

to something like

  library_examples = cpp_library.example_sketches

  if library_examples.empty?
    inform("Skipping compilation of examples") { "as these do not exist. Preferably you should at least add one." }
    return
  end