arduino_ci 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a109dd9f9d784f5cc6b9e471366323b649cd46b6
4
- data.tar.gz: 2b3e1296eff822fc0df13e9197c9f13b6b0a048d
3
+ metadata.gz: 8f6fbc6b2113cea4a9188991098986ce101f0314
4
+ data.tar.gz: 9239e52f0d098c9da5d0cec667aa2cb88239ed37
5
5
  SHA512:
6
- metadata.gz: 3a6a744be45d9b53740dfe5f9b1ed2850275bd397003adef61d63cc654f2baed573dbc3fe9ca00cbe7e89dd9dd07514bfd56460eb605e1d69a32638125012e19
7
- data.tar.gz: feb7bdf3f740f15eb53dca481e4d9401e99243478711ccddb0ee0a342f7b1d5b98b277a54095ad17af3963ee0af0f4c506c04353d780d9c822e1b0a9458fd3db
6
+ metadata.gz: 7d9953fd77ffbf8e209f5bd671b8002b86b3b2e43538b452540dd2e102a4792bf4316782c0370a0ea5afcef728224314e4ea293a1ab9aaa4c0b2f5dd0b63b7cc
7
+ data.tar.gz: a2e241d167a95618398a9d9ce71f31bf8ad6473211de709aa7812d9b981f484fb5d2d02f08d0598edf35695ec6bce4416ce2cd13bfd6d94d9c5476b305cbc40e
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.2.1)
2
+ # ArduinoCI Ruby gem (`arduino_ci`) [![Gem Version](https://badge.fury.io/rb/arduino_ci.svg)](https://rubygems.org/gems/arduino_ci) [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/arduino_ci/0.3.0)
3
3
 
4
4
  You want to run tests on your Arduino library (bonus: without hardware present), but the IDE doesn't support that. Arduino CI provides that ability.
5
5
 
@@ -183,7 +183,9 @@ def perform_unit_tests(file_config)
183
183
  return
184
184
  end
185
185
  config = file_config.with_override_config(@cli_options[:ci_config])
186
- cpp_library = ArduinoCI::CppLibrary.new(Pathname.new("."), @arduino_cmd.lib_dir)
186
+ cpp_library = ArduinoCI::CppLibrary.new(Pathname.new("."),
187
+ @arduino_cmd.lib_dir,
188
+ config.exclude_dirs.map(&Pathname.method(:new)))
187
189
 
188
190
  # check GCC
189
191
  compilers = config.compilers_to_use
@@ -28,6 +28,7 @@ UNITTEST_SCHEMA = {
28
28
  compilers: Array,
29
29
  platforms: Array,
30
30
  libraries: Array,
31
+ exclude_dirs: Array,
31
32
  testfiles: {
32
33
  select: Array,
33
34
  reject: Array,
@@ -256,6 +257,14 @@ module ArduinoCI
256
257
  @unittest_info[:compilers]
257
258
  end
258
259
 
260
+ # paths to exclude all files in for building and unitttests
261
+ # @return [Array<String>] The directories (relative to base dir) to exclude
262
+ def exclude_dirs
263
+ return [] if @unittest_info[:exclude_dirs].nil?
264
+
265
+ @unittest_info[:exclude_dirs]
266
+ end
267
+
259
268
  # platforms to build [the examples on]
260
269
  # @return [Array<String>] The platforms to build
261
270
  def platforms_to_build
@@ -37,11 +37,15 @@ module ArduinoCI
37
37
 
38
38
  # @param base_dir [Pathname] The path to the library being tested
39
39
  # @param arduino_lib_dir [Pathname] The path to the libraries directory
40
- def initialize(base_dir, arduino_lib_dir)
40
+ # @param exclude_dirs [Array<Pathname>] Directories that should be excluded from compilation
41
+ def initialize(base_dir, arduino_lib_dir, exclude_dirs)
41
42
  raise ArgumentError, 'base_dir is not a Pathname' unless base_dir.is_a? Pathname
42
43
  raise ArgumentError, 'arduino_lib_dir is not a Pathname' unless arduino_lib_dir.is_a? Pathname
44
+ raise ArgumentError, 'exclude_dir is not an array of Pathnames' unless exclude_dirs.is_a?(Array)
45
+ raise ArgumentError, 'exclude_dir array contains non-Pathname elements' unless exclude_dirs.all? { |p| p.is_a? Pathname }
43
46
 
44
47
  @base_dir = base_dir
48
+ @exclude_dirs = exclude_dirs
45
49
  @arduino_lib_dir = arduino_lib_dir.expand_path
46
50
  @artifacts = []
47
51
  @last_err = ""
@@ -115,6 +119,19 @@ module ArduinoCI
115
119
  false
116
120
  end
117
121
 
122
+ # Guess whether a file is part of any @excludes_dir dir (indicating library compilation should ignore it).
123
+ #
124
+ # @param path [Pathname] The path to check
125
+ # @return [bool]
126
+ def in_exclude_dir?(path)
127
+ # we could do this but some rubies don't return an enumerator for ascend
128
+ # path.ascend.any? { |part| tests_dir_aliases.include?(part) }
129
+ path.ascend do |part|
130
+ return true if exclude_dir.any? { |p| p.realpath == part }
131
+ end
132
+ false
133
+ end
134
+
118
135
  # Check whether libasan (and by extension -fsanitizer=address) is supported
119
136
  #
120
137
  # This requires compilation of a sample program, and will be cached
@@ -150,7 +167,7 @@ module ArduinoCI
150
167
  # CPP files that are part of the project library under test
151
168
  # @return [Array<Pathname>]
152
169
  def cpp_files
153
- cpp_files_in(@base_dir).reject { |p| vendor_bundle?(p) || in_tests_dir?(p) }
170
+ cpp_files_in(@base_dir).reject { |p| vendor_bundle?(p) || in_tests_dir?(p) || in_exclude_dir?(p) }
154
171
  end
155
172
 
156
173
  # CPP files that are part of the arduino mock library we're providing
@@ -172,6 +189,12 @@ module ArduinoCI
172
189
  arduino_library_src_dirs(aux_libraries).map { |d| cpp_files_in(d) }.flatten.uniq
173
190
  end
174
191
 
192
+ # Returns the Pathnames for all paths to exclude from testing and compilation
193
+ # @return [Array<Pathname>]
194
+ def exclude_dir
195
+ @exclude_dirs.map { |p| Pathname.new(@base_dir) + p }.select(&:exist?)
196
+ end
197
+
175
198
  # The directory where we expect to find unit test defintions provided by the user
176
199
  # @return [Pathname]
177
200
  def tests_dir
@@ -190,7 +213,8 @@ module ArduinoCI
190
213
  real = @base_dir.realpath
191
214
  all_files = Find.find(real).map { |f| Pathname.new(f) }.reject(&:directory?)
192
215
  unbundled = all_files.reject { |path| vendor_bundle?(path) }
193
- files = unbundled.select { |path| HPP_EXTENSIONS.include?(path.extname.downcase) }
216
+ unexcluded = unbundled.reject { |path| in_exclude_dir?(path) }
217
+ files = unexcluded.select { |path| HPP_EXTENSIONS.include?(path.extname.downcase) }
194
218
  files.map(&:dirname).uniq
195
219
  end
196
220
 
@@ -1,3 +1,3 @@
1
1
  module ArduinoCI
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arduino_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Katz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.15'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.15'
55
55
  - !ruby/object:Gem::Dependency