Skip to content

Commit 5325ad8

Browse files
committed
Iterate over boards before examples
1 parent f238903 commit 5325ad8

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99

1010
### Changed
11+
- `arduino_ci_remote.rb` now iterates over example platforms before examples (saves time)
1112

1213
### Deprecated
1314

exe/arduino_ci_remote.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,22 @@ def assured_platform(purpose, name, config)
207207
else
208208
attempt("Setting compiler warning level") { @arduino_cmd.set_pref("compiler.warning_level", "all") }
209209

210-
# unlike previous, iterate examples / boards
211-
library_examples.each do |example_path|
210+
# switching boards takes time, so iterate board first
211+
# _then_ whichever examples match it
212+
examples_by_platform = library_examples.each_with_object({}) do |example_path, acc|
212213
ovr_config = config.from_example(example_path)
213214
ovr_config.platforms_to_build.each do |p|
214-
board = all_platforms[p][:board]
215-
assure("Switching to board for #{p} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
216-
last_board = board
215+
acc[p] = [] unless acc.key?(p)
216+
acc[p] << example_path
217+
end
218+
end
219+
220+
examples_by_platform.each do |platform, example_paths|
221+
board = all_platforms[platform][:board]
222+
assure("Switching to board for #{platform} (#{board})") { @arduino_cmd.use_board(board) } unless last_board == board
223+
last_board = board
224+
225+
example_paths.each do |example_path|
217226
example_name = File.basename(example_path)
218227
attempt("Verifying #{example_name}") do
219228
ret = @arduino_cmd.verify_sketch(example_path)

0 commit comments

Comments
 (0)