fastlane-plugin-ciutils 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 391de8fd98eca2f9a7a20909cf8bebcd236d9397
|
4
|
+
data.tar.gz: 9c7216300bdb4019e642f626253ee10463265e90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610f9211ffe0be990b2021f2964c9667265a6d08fbcec60f6a8b6921c0b24634554e7a040382d8326b81beda162fdb3320afa29ac9904d43944c75aa99b5e80f
|
7
|
+
data.tar.gz: c7b230623ae24482688346109b6eb212b23ad9abf75cce3e0dcfa34da0b056fc56306b3eb62eeca05f946a5f91631a111a7c2bab345f2995d1b3c0b560f4af0c
|
data/README.md
CHANGED
@@ -16,21 +16,22 @@ Various utilities for CI and Xcode project configuration.
|
|
16
16
|
|
17
17
|
action |description
|
18
18
|
-------------------------|-------
|
19
|
-
`en_ci_utils_init` | Initializes
|
20
|
-
`
|
19
|
+
`en_ci_utils_init` | Initializes enviornment variables for **gym**, **scan**, **slather**, **oclint**, **swiftlint** and **lizard**. <br> It forces all these actions to put all outputs to the **build** folder (e.g. derived data, logs, scan reports, slather reports, oclint report, lizard reports and swiftlint reports)
|
20
|
+
`en_setup_project` | Updates Xcode projects, Info.plist, Entitlements file and any other plist file using values from the provided yaml file [example `appstore.yml`](Demo/config/appstore.yml)
|
21
|
+
`en_create_sonar_reports` | Creates sonarqube reports (unit tests, code coverage, static code analysis with swiftlint, oclint and lizard) to be used with the open source sonarqube plugins for Swift and Objective-C
|
21
22
|
`en_build_number` | Returns the value of current build number regardless of CI environment. If run on desktop, then is always `1`
|
22
|
-
`en_setup_keychain` | Creates a keychain and imports the
|
23
|
+
`en_setup_keychain` | Creates a keychain and if provided, it imports the give certificate file. It also updates **match** environment variables to use the new created keychain.
|
23
24
|
`en_remove_keychain` | Removes the keychain created by ```en_setup_keychain``` and restores the default keychain
|
24
25
|
`en_git_changelog` | Creates the changelog based on git commits by filtering commit messages by a keyword
|
25
26
|
`en_close_simulator` | Quits the simulator
|
26
|
-
`en_install_provisioning_profiles` | Copies all provisioning profiles from project folder to `~/Library/MobileDevice/Provisioning Profiles
|
27
|
-
`
|
27
|
+
`en_install_provisioning_profiles` | Copies all provisioning profiles from project folder to `~/Library/MobileDevice/Provisioning Profiles`. <br> Useful when signing certificates and provisioning profiles are managed directly from the Fastfile.
|
28
|
+
`en_profile_name` | Returns the provisioning profile name by path or uuid
|
28
29
|
|
29
30
|
|
30
31
|
|
31
32
|
## Example
|
32
33
|
|
33
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane
|
34
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) and [project `FastlaneDemo`](Demo) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane build`.
|
34
35
|
|
35
36
|
## Run tests for this plugin
|
36
37
|
|
@@ -2,27 +2,46 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class EnCiUtilsInitAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
output_path = "./build"
|
6
|
+
reports_path = "#{output_path}/reports"
|
7
|
+
logs_path = "#{output_path}/logs"
|
8
8
|
|
9
|
-
|
10
|
-
ENV['
|
11
|
-
ENV['
|
12
|
-
|
9
|
+
ENV['ENCI_OUTPUT_PATH'] = output_path
|
10
|
+
ENV['ENCI_REPORTS_PATH'] = reports_path
|
11
|
+
ENV['ENCI_LOGS_PATH'] = logs_path
|
12
|
+
|
13
|
+
# gym: ipa
|
14
|
+
ENV['GYM_OUTPUT_DIRECTORY'] = output_path
|
15
|
+
ENV['GYM_BUILDLOG_PATH'] = "#{logs_path}/gym"
|
16
|
+
ENV['GYM_RESULT_BUNDLE'] = "true"
|
17
|
+
ENV['GYM_DERIVED_DATA_PATH'] = "#{output_path}/deriveddata_gym"
|
18
|
+
|
19
|
+
# scan: unit tests
|
20
|
+
ENV['SCAN_OUTPUT_DIRECTORY'] = "#{reports_path}/unittests"
|
21
|
+
ENV['SCAN_BUILDLOG_PATH'] = "#{logs_path}/scan/"
|
22
|
+
ENV['SCAN_DERIVED_DATA_PATH'] = "#{output_path}/deriveddata_scan"
|
13
23
|
ENV['SCAN_OUTPUT_TYPES'] = "html,junit,json-compilation-database"
|
24
|
+
ENV['SCAN_CONFIGURATION'] = "Debug"
|
25
|
+
ENV['SCAN_XCARGS'] = "COMPILER_INDEX_STORE_ENABLE=NO"
|
14
26
|
|
15
|
-
|
16
|
-
ENV['
|
27
|
+
# slather: code coverage reports
|
28
|
+
ENV['FL_SLATHER_BUILD_DIRECTORY'] = "#{output_path}/deriveddata_scan"
|
29
|
+
ENV['FL_SLATHER_OUTPUT_DIRECTORY'] = "#{reports_path}"
|
17
30
|
ENV['FL_SLATHER_COBERTURA_XML_ENABLED'] = "true"
|
18
31
|
ENV['FL_SLATHER_USE_BUNDLE_EXEC'] = "true"
|
19
32
|
ENV['FL_SLATHER_HTML_ENABLED'] = "false"
|
33
|
+
ENV['FL_SLATHER_INPUT_FORMAT'] = "profdata"
|
34
|
+
ENV['FL_SLATHER_CONFIGURATION'] = "Debug"
|
35
|
+
|
36
|
+
# swiftlint: static code analysis and linter
|
37
|
+
ENV['FL_SWIFTLINT_OUTPUT'] = "#{reports_path}/swiftlint.txt"
|
20
38
|
|
21
|
-
#
|
22
|
-
ENV['
|
39
|
+
# lizard: static code analysis and linter
|
40
|
+
ENV['FL_LIZARD_OUTPUT'] = "#{reports_path}/lizard-report.xml"
|
23
41
|
|
24
|
-
#
|
25
|
-
ENV['
|
42
|
+
# oclint: static code analysis and linter
|
43
|
+
ENV['FL_OCLINT_REPORT_TYPE'] = "pmd"
|
44
|
+
ENV['FL_OCLINT_ENABLE_CLANG_STATIC_ANALYZER'] = "true"
|
26
45
|
|
27
46
|
ENV['BUILD_NUMBER'] = Helper::CiutilsHelper.en_ci_build_number()
|
28
47
|
ENV['FL_BUILD_NUMBER_BUILD_NUMBER'] = ENV['BUILD_NUMBER']
|
@@ -0,0 +1,171 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class EnCreateSonarReportsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
build_path = ENV['ENCI_OUTPUT_PATH']
|
6
|
+
reports_path = ENV['ENCI_REPORTS_PATH']
|
7
|
+
logs_path = ENV['ENCI_LOGS_PATH']
|
8
|
+
scan_logs_path = ENV['SCAN_BUILDLOG_PATH']
|
9
|
+
scan_reports_path = ENV['SCAN_OUTPUT_DIRECTORY']
|
10
|
+
|
11
|
+
lizard_output_path = ENV['FL_LIZARD_OUTPUT']
|
12
|
+
swiftlint_output_path = ENV['FL_SWIFTLINT_OUTPUT']
|
13
|
+
|
14
|
+
lizard_extra_args = params[:lizard_extra_args]
|
15
|
+
swiftlint_extra_args = params[:swiftlint_extra_args]
|
16
|
+
|
17
|
+
swiftlint_path_args = self.swiftlint_path_args(params)
|
18
|
+
lizard_path_args = self.lizard_path_args(params)
|
19
|
+
|
20
|
+
unless File.exist?(scan_reports_path)
|
21
|
+
UI.user_error!("Please run scan and slather first.")
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
FileUtils::mkdir_p(reports_path) unless File.exists?(reports_path)
|
26
|
+
|
27
|
+
# create the junit reports again in such way that can be used by sonar
|
28
|
+
sh("cat '#{scan_logs_path}'/*.log | bundle exec ocunit2junit > /dev/null 2>&1 || exit 0")
|
29
|
+
|
30
|
+
# ocunit2junit creates the reports in local test-reports, it needs to be moved
|
31
|
+
FileUtils::rm_rf("#{scan_reports_path}/test-reports")
|
32
|
+
FileUtils::mv("test-reports", "#{scan_reports_path}")
|
33
|
+
|
34
|
+
if Dir.glob("#{scan_reports_path}/test-reports/*.xml").empty?
|
35
|
+
# ocunit2junit failed?
|
36
|
+
UI.message("ocunit2junit failed, copying the original junit report to test-reports")
|
37
|
+
FileUtils::cp("#{scan_reports_path}/report.junit", "#{scan_reports_path}/test-reports/report.xml")
|
38
|
+
end
|
39
|
+
|
40
|
+
# run static code analysis
|
41
|
+
unless params[:skip_swiftlint_analysis]
|
42
|
+
sh("swiftlint lint #{swiftlint_path_args} --quiet > '#{swiftlint_output_path}' || exit 0")
|
43
|
+
end
|
44
|
+
|
45
|
+
unless params[:skip_lizard_analysis]
|
46
|
+
sh("lizard #{lizard_path_args} -l swift -l objectivec --xml #{lizard_extra_args} > '#{lizard_output_path}' || exit 0")
|
47
|
+
end
|
48
|
+
|
49
|
+
# workaround sonar plugin, it is not picking correctly the path to lizard report
|
50
|
+
# and it is looking at the default path
|
51
|
+
FileUtils::ln_sf(reports_path, "sonar-reports")
|
52
|
+
|
53
|
+
unless params[:skip_oclint_analysis]
|
54
|
+
scan_json_compilation_database = File.expand_path(scan_reports_path) + '/report.json-compilation-database'
|
55
|
+
json_compilation_database = File.expand_path(scan_reports_path) + '/compile_commands.json'
|
56
|
+
FileUtils::cp("#{scan_reports_path}/report.json-compilation-database", json_compilation_database)
|
57
|
+
other_action.oclint(compile_commands: scan_json_compilation_database)
|
58
|
+
FileUtils::mv("./fastlane/oclint_report.pmd", "#{reports_path}/oclint.xml")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.normalize_paths(paths)
|
63
|
+
paths.split(",").map { |path| File.expand_path(path.strip) }
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.lizard_path_args(params)
|
67
|
+
include_files = ""
|
68
|
+
|
69
|
+
if params[:include_path]
|
70
|
+
self.normalize_paths(params[:include_path]).each do |path|
|
71
|
+
include_files += " '#{path}' "
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
exclude_files = ""
|
76
|
+
if params[:exclude_path]
|
77
|
+
self.normalize_paths(params[:exclude_path]).each do |path|
|
78
|
+
exclude_files += " -x '#{path}/*' "
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
include_files + exclude_files
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.swiftlint_path_args(params)
|
86
|
+
include_files = ""
|
87
|
+
|
88
|
+
if params[:include_path]
|
89
|
+
self.normalize_paths(params[:include_path]).each do |path|
|
90
|
+
include_files += " --path '#{path}'"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# exclude_files = ""
|
95
|
+
# if params[:exclude_path]
|
96
|
+
# self.normalize_paths(params[:exclude_path]).each do |path|
|
97
|
+
# exclude_files += " --force-exclude '#{path}' "
|
98
|
+
# end
|
99
|
+
# end
|
100
|
+
|
101
|
+
# include_files + exclude_files
|
102
|
+
include_files
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.available_options
|
106
|
+
[
|
107
|
+
FastlaneCore::ConfigItem.new(key: :include_path,
|
108
|
+
env_name: "FL_EN_ANALYSIS_INCLUDE_SRC",
|
109
|
+
description: 'One or multiple paths comma separated to include into scan report',
|
110
|
+
optional: false),
|
111
|
+
|
112
|
+
FastlaneCore::ConfigItem.new(key: :exclude_path,
|
113
|
+
env_name: "FL_EN_ANALYSIS_EXCLUDE_SRC",
|
114
|
+
description: 'One or multiple paths comma separated to include into scan report',
|
115
|
+
optional: true),
|
116
|
+
|
117
|
+
FastlaneCore::ConfigItem.new(key: :skip_oclint_analysis,
|
118
|
+
env_name: "FL_EN_SKIP_OCLINT_ANALYSIS",
|
119
|
+
description: "Skip running oclint code analysis",
|
120
|
+
is_string: false,
|
121
|
+
default_value: false,
|
122
|
+
optional: true),
|
123
|
+
|
124
|
+
FastlaneCore::ConfigItem.new(key: :skip_swiftlint_analysis,
|
125
|
+
env_name: "FL_EN_SKIP_SWIFTLINT_ANALYSIS",
|
126
|
+
description: "Skip running swiftlint code analysis",
|
127
|
+
is_string: false,
|
128
|
+
default_value: false,
|
129
|
+
optional: true),
|
130
|
+
|
131
|
+
FastlaneCore::ConfigItem.new(key: :swiftlint_extra_args,
|
132
|
+
env_name: "FL_EN_SWIFTLINT_EXTRA ARGS",
|
133
|
+
description: 'Extra command line args for swiftlint',
|
134
|
+
optional: true),
|
135
|
+
|
136
|
+
FastlaneCore::ConfigItem.new(key: :skip_lizard_analysis,
|
137
|
+
env_name: "FL_EN_SKIP_LIZARD_ANALYSIS",
|
138
|
+
description: "Skip running lizard code analysis",
|
139
|
+
is_string: false,
|
140
|
+
default_value: false,
|
141
|
+
optional: true),
|
142
|
+
|
143
|
+
FastlaneCore::ConfigItem.new(key: :lizard_extra_args,
|
144
|
+
env_name: "FL_EN_LIZARD_EXTRA ARGS",
|
145
|
+
description: 'Extra command line args for lizard',
|
146
|
+
optional: true)
|
147
|
+
]
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.description
|
151
|
+
"Creates swiftlint, lizard and oclint reports and adjusts junit reports for sonarqube (with the open source swift/objc plugin)"
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.details
|
155
|
+
"Ensure before calling this action ensure en_ci_utils_init_action, scan and slather were executed.
|
156
|
+
This action re-uses values for used for scan and env variables set by en_ci_utils_init_action for reports paths.
|
157
|
+
The oclint command is executed throug the oclint action. You can change input for that action through oclint action env variables.
|
158
|
+
|
159
|
+
The exclude files option doesn't work for swiftlint and oclint. You can exclude files in sonar properties or for swiftlint with .swiftlint.yml"
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.authors
|
163
|
+
["Nicolae Ghimbovschi"]
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.is_supported?(platform)
|
167
|
+
platform == :ios
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-ciutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolae Ghimbovschi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slather
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- lib/fastlane/plugin/ciutils/actions/en_build_number.rb
|
163
163
|
- lib/fastlane/plugin/ciutils/actions/en_ci_utils_init_action.rb
|
164
164
|
- lib/fastlane/plugin/ciutils/actions/en_close_simulator.rb
|
165
|
+
- lib/fastlane/plugin/ciutils/actions/en_create_sonar_reports.rb
|
165
166
|
- lib/fastlane/plugin/ciutils/actions/en_git_changelog.rb
|
166
167
|
- lib/fastlane/plugin/ciutils/actions/en_install_provisioning_profiles.rb
|
167
168
|
- lib/fastlane/plugin/ciutils/actions/en_profile_name.rb
|