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 +4 -4
- data/README.md +1 -1
- data/exe/arduino_ci_remote.rb +3 -1
- data/lib/arduino_ci/ci_config.rb +9 -0
- data/lib/arduino_ci/cpp_library.rb +27 -3
- data/lib/arduino_ci/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f6fbc6b2113cea4a9188991098986ce101f0314
|
4
|
+
data.tar.gz: 9239e52f0d098c9da5d0cec667aa2cb88239ed37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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`) [](https://rubygems.org/gems/arduino_ci) [](http://www.rubydoc.info/gems/arduino_ci/0.
|
2
|
+
# ArduinoCI Ruby gem (`arduino_ci`) [](https://rubygems.org/gems/arduino_ci) [](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
|
|
data/exe/arduino_ci_remote.rb
CHANGED
@@ -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("."),
|
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
|
data/lib/arduino_ci/ci_config.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
|
data/lib/arduino_ci/version.rb
CHANGED
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.
|
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-
|
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
|