yast-rake 0.2.43 → 0.2.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/data/targets.yml +2 -2
- data/lib/tasks/github_actions/github_actions/job.rb +2 -1
- data/lib/tasks/github_actions/github_actions/job_runner.rb +17 -1
- data/lib/tasks/rubocop.rake +34 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac63a47eacc8d5837b6ec2ca69605c214fed661530fbae576d154706d8a1317f
|
4
|
+
data.tar.gz: ef9b8e4ebd0846d0d9f2d72c3b17e1176d4afd674156dbfeb5f39339b13a0488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cafea33f6f6a17c45b1eae38368536d5f283f939118ab5fd6d0af7dd1bc8c2cf59b75aa8b27dca6ba1100c04417ae7ea548a2a16075d3484a6dcd73aeb07c05e
|
7
|
+
data.tar.gz: a7c9caac9a4c08d87aa8371459cec1d4c06c26bf7ee2c2135337e48c74a3a9d3914a043978ad7f23666fa917c7fe33f517bc9c6ea0439510b286cc6e0c63eeac
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.46
|
data/data/targets.yml
CHANGED
@@ -98,8 +98,8 @@
|
|
98
98
|
:sle_latest:
|
99
99
|
obs_api: "https://api.suse.de/"
|
100
100
|
obs_project: "Devel:YaST:Head"
|
101
|
-
obs_sr_project: "SUSE:SLE-15-
|
102
|
-
obs_target: "SUSE_SLE-15-
|
101
|
+
obs_sr_project: "SUSE:SLE-15-SP5:GA"
|
102
|
+
obs_target: "SUSE_SLE-15-SP5_GA"
|
103
103
|
:factory:
|
104
104
|
obs_project: "YaST:Head"
|
105
105
|
obs_sr_project: "openSUSE:Factory"
|
@@ -22,7 +22,7 @@ module GithubActions
|
|
22
22
|
# Github Actions job
|
23
23
|
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
24
24
|
class Job
|
25
|
-
attr_reader :name, :steps, :runs_on, :container, :workflow
|
25
|
+
attr_reader :name, :steps, :runs_on, :container, :workflow, :matrix
|
26
26
|
|
27
27
|
# @param name [String] name of the job
|
28
28
|
# @param data [Hash] data from the workflow YAML file
|
@@ -32,6 +32,7 @@ module GithubActions
|
|
32
32
|
@runs_on = data["runs-on"]
|
33
33
|
@container = data["container"]
|
34
34
|
@workflow = workflow
|
35
|
+
@matrix = data.fetch("strategy", {})["matrix"]
|
35
36
|
|
36
37
|
@steps = data["steps"].map do |step|
|
37
38
|
Step.new(self, step)
|
@@ -78,7 +78,23 @@ module GithubActions
|
|
78
78
|
abort "Unsupported container definition: #{job.container.inspect}"
|
79
79
|
end
|
80
80
|
|
81
|
-
Container.new(image_name, options.to_s)
|
81
|
+
Container.new(expand_name(image_name), options.to_s)
|
82
|
+
end
|
83
|
+
|
84
|
+
# replace the ${{ matrix.<value> }} placeholders in the image name
|
85
|
+
#
|
86
|
+
# @param image_name [String] name of the Docker image
|
87
|
+
# @return [String] name with replaced values
|
88
|
+
def expand_name(image_name)
|
89
|
+
image_name.gsub(/\$\{\{\s*matrix\.[^}]*\}\}/) do |subst|
|
90
|
+
name = /\$\{\{\s*matrix\.([^}]*)\}\}/.match(subst)[1].strip
|
91
|
+
value = job.matrix ? job.matrix[name] : subst
|
92
|
+
|
93
|
+
# if the value is an Array use the first value by default
|
94
|
+
replacement = value.is_a?(Array) ? value.first : value.to_s
|
95
|
+
puts "Using ${{matrix.#{name}}} value: #{replacement.inspect}"
|
96
|
+
replacement
|
97
|
+
end
|
82
98
|
end
|
83
99
|
|
84
100
|
# run a job step
|
data/lib/tasks/rubocop.rake
CHANGED
@@ -15,12 +15,24 @@
|
|
15
15
|
#
|
16
16
|
#++
|
17
17
|
|
18
|
+
# the default old version used
|
19
|
+
OLD_RUBOCOP_VERSION = "0.41.2"
|
20
|
+
|
21
|
+
def rubocop_version
|
22
|
+
return @rubocop_version if @rubocop_version
|
23
|
+
|
24
|
+
@rubocop_version = if File.read(".rubocop.yml").match(/rubocop-(\d+\.\d+\.\d+)/)
|
25
|
+
Regexp.last_match[1]
|
26
|
+
else
|
27
|
+
OLD_RUBOCOP_VERSION
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
18
31
|
def rubocop_bin
|
19
32
|
return @rubocop_bin if @rubocop_bin
|
20
33
|
return @rubocop_bin = ENV["RUBOCOP_BIN"] if ENV["RUBOCOP_BIN"]
|
21
34
|
|
22
|
-
|
23
|
-
binary = `/usr/sbin/update-alternatives --list rubocop | grep '#{version}'`.strip
|
35
|
+
binary = `/usr/sbin/update-alternatives --list rubocop | grep '#{rubocop_version}'`.strip
|
24
36
|
if !system("which #{binary}")
|
25
37
|
raise "cannot find proper version of rubocop binary in " \
|
26
38
|
"'/usr/sbin/update-alternatives --list rubocop'." \
|
@@ -32,18 +44,26 @@ end
|
|
32
44
|
# run Rubocop in parallel
|
33
45
|
# @param params [String] optional Rubocop parameters
|
34
46
|
def run_rubocop(params = "")
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
# newer Rubocop versions support the "-P" ("--parallel") option,
|
48
|
+
# but that is not compatible with the "-a" ("--auto-correct") option
|
49
|
+
if rubocop_version != OLD_RUBOCOP_VERSION && !params.to_s.match(/-a|--auto-correct/)
|
50
|
+
sh "#{rubocop_bin} -P #{params}"
|
51
|
+
else
|
52
|
+
# for older Rubocop or auto-correct mode manually start multiple instances in parallel
|
53
|
+
#
|
54
|
+
# how it works:
|
55
|
+
# 1) get the list of inspected files by Rubocop
|
56
|
+
# 2) shuffle it randomly (better would be evenly distribute them according to
|
57
|
+
# the analysis complexity but that is hard to evaluate and even simply
|
58
|
+
# distributing by file size turned out to be ineffective and slower than
|
59
|
+
# a simple random shuffling)
|
60
|
+
# 3) pass that as input for xargs
|
61
|
+
# a) use -P with number of processors to run the commands in parallel
|
62
|
+
# b) use -n to set the maximum number of files per process, this number
|
63
|
+
# is computed to equally distribute the files across the workers
|
64
|
+
sh "#{rubocop_bin} -L | sort -R | xargs -P`nproc` -n$(expr `#{rubocop_bin} -L | wc -l` / " \
|
65
|
+
"`nproc` + 1) #{rubocop_bin} #{params}"
|
66
|
+
end
|
47
67
|
end
|
48
68
|
|
49
69
|
namespace :check do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yast-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: packaging_rake_tasks
|