From cc607a6247b4d83c6fbe4d9f5af21400e92ddcae Mon Sep 17 00:00:00 2001 From: Ian Katz Date: Thu, 8 Jun 2023 09:17:57 -0400 Subject: [PATCH] Fix issue #352 - backend used before assigned when loading dependencies --- .github/workflows/linux.yaml | 15 +++++++++++++++ CHANGELOG.md | 1 + SampleProjects/BusIO/.arduino-ci.yml | 5 ++--- SampleProjects/BusIO/README.md | 6 +++++- SampleProjects/BusIO/library.properties | 1 + exe/arduino_ci.rb | 11 ++++++----- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index d3a35a75..5d4876b2 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -4,6 +4,21 @@ name: linux on: [push, pull_request] jobs: + "BusIO_with_dependencies": + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Check usage - Test BusIO from scratch + run: | + g++ -v + cd SampleProjects/BusIO + bundle install + bundle exec ensure_arduino_installation.rb + bundle exec arduino_ci.rb + "rubocop": runs-on: ubuntu-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab732fc..3ba74f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Removed ### Fixed +- Fixes #352, in which the Arduino backend was being referenced in the CI runner before being explicitly assigned; this affected all tests of modules that used `library.properties` to specify runtime Arduino module dependencies. ### Security diff --git a/SampleProjects/BusIO/.arduino-ci.yml b/SampleProjects/BusIO/.arduino-ci.yml index 2237cd47..ba72854a 100644 --- a/SampleProjects/BusIO/.arduino-ci.yml +++ b/SampleProjects/BusIO/.arduino-ci.yml @@ -2,11 +2,10 @@ unittest: platforms: - mega2560 libraries: - - "Adafruit BusIO" - # - "Adafruit_BusIO" <= This works if you have the library pre-installed + - "Adafruit_BusIO" compile: platforms: - mega2560 libraries: - - "Adafruit BusIO" + - "Adafruit_BusIO" diff --git a/SampleProjects/BusIO/README.md b/SampleProjects/BusIO/README.md index 86e2e642..14dcd9e8 100644 --- a/SampleProjects/BusIO/README.md +++ b/SampleProjects/BusIO/README.md @@ -1,4 +1,8 @@ # BusIO This is an example of a library that depends on Adafruit BusIO. -It is provided to help reproduce #192. +It is provided to help reproduce #192 and #352. + +This example specifies a dependency in `library.properties`, which +exercises the `arduino_ci.rb` CI runner in a way that the other +SampleProjects currently do not. diff --git a/SampleProjects/BusIO/library.properties b/SampleProjects/BusIO/library.properties index 964dc329..4cb5ba17 100644 --- a/SampleProjects/BusIO/library.properties +++ b/SampleProjects/BusIO/library.properties @@ -8,3 +8,4 @@ category=Other url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/BusIO architectures=avr,esp8266 includes=BusIO.h +depends=Adafruit BusIO diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index ad4f9776..d3dfbaac 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -351,11 +351,6 @@ def perform_bootstrap end end - install_arduino_library_dependencies( - cpp_library.arduino_library_dependencies, - "<#{ArduinoCI::CppLibrary::LIBRARY_PROPERTIES_FILE}>" - ) - # return all objects needed by other steps { backend: backend, @@ -604,6 +599,12 @@ def perform_example_compilation_tests(cpp_library, config) strap = perform_bootstrap @backend = strap[:backend] + +install_arduino_library_dependencies( + strap[:cpp_library].arduino_library_dependencies, + "<#{ArduinoCI::CppLibrary::LIBRARY_PROPERTIES_FILE}>" +) + perform_unit_tests(strap[:cpp_library], strap[:config]) perform_example_compilation_tests(strap[:cpp_library], strap[:config])