File tree 6 files changed +167
-63
lines changed
6 files changed +167
-63
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- name : Unit Test Call
1
+ name : Appraisal
2
2
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
+ spec :
7
+ required : true
8
+ type : string
6
9
engine_name :
7
10
required : true
8
11
type : string
9
12
engine_version :
10
13
required : true
11
14
type : string
15
+ appraisal :
16
+ required : true
17
+ type : string
12
18
13
19
jobs :
14
- matrix :
15
- runs-on : ubuntu-latest
16
- container :
17
- image : " ruby:3.3"
18
- name : Prepare matrix
19
- outputs :
20
- matrix : ${{ steps.matrix.outputs.matrix }}
21
- steps :
22
- - uses : actions/checkout@v4
23
- - name : Compute matrix
24
- id : matrix
25
- run : |
26
- matrix="$(ruby matrix.rb engine.name:${{ inputs.engine_name }} engine.version:${{ inputs.engine_version }})"
27
- echo "${matrix}"
28
- echo "${matrix}" | ruby -rjson -0777 -ne 'pp JSON.parse($_)'
29
- echo "matrix=${matrix}" >> $GITHUB_OUTPUT
30
-
31
20
test :
32
21
runs-on : ubuntu-latest
33
- name : Test ${{ matrix.spec.task }} ${{ matrix.spec.appraisal }} ( ${{ inputs.engine_name }} ${{ inputs.engine_version }})
22
+ name : " Test ${{ matrix.appraisal }} ( ${{ matrix.engine.name }}: ${{ matrix.engine.version }} ${{ matrix.spec }})"
34
23
needs : matrix
35
24
strategy :
36
25
fail-fast : false
37
- matrix : ${{ fromJSON(needs.matrix.outputs.matrix) }}
26
+ matrix :
27
+ spec :
28
+ - ${{ inputs.spec }}
29
+ engine :
30
+ - name : $${ inputs.engine_name }}
31
+ version : $${ inputs.engine_version }}
32
+ appraisal :
33
+ - ${{ inputs.appraisal }}
38
34
env :
39
35
SKIP_SIMPLECOV : 1
40
36
DD_INSTRUMENTATION_TELEMETRY_ENABLED : false
60
56
export BUNDLE_GEMFILE
61
57
fi
62
58
bundle exec rake spec:${{ matrix.spec.task }}
63
-
Original file line number Diff line number Diff line change
1
+ name : Engine
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ engine_name :
7
+ required : true
8
+ type : string
9
+ engine_version :
10
+ required : true
11
+ type : string
12
+ spec :
13
+ required : true
14
+ type : string
15
+
16
+ jobs :
17
+ matrix :
18
+ runs-on : ubuntu-latest
19
+ container :
20
+ image : " ruby:3.3"
21
+ name : Prepare matrix
22
+ outputs :
23
+ matrix : ${{ steps.matrix.outputs.matrix }}
24
+ steps :
25
+ - uses : actions/checkout@v4
26
+ - name : Compute matrix
27
+ id : matrix
28
+ run : |
29
+ matrix="$(ruby matrix.rb --json appraisals spec:#{{ inputs.spec }} engine.name:${{ inputs.engine_name }} engine.version:${{ inputs.engine_version }})"
30
+ echo "${matrix}" | ruby -rjson -0777 -ne 'puts JSON.pretty_generate JSON.parse($_)'
31
+ echo "matrix=${matrix}" >> $GITHUB_OUTPUT
32
+
33
+ test :
34
+ runs-on : ubuntu-latest
35
+ name : " ${{ matrix.appraisal }} (${{ matrix.engine.name }}:${{ matrix.engine.version }} ${{ matrix.spec }})"
36
+ needs : matrix
37
+ strategy :
38
+ fail-fast : false
39
+ matrix :
40
+ spec :
41
+ - ${{ inputs.spec }}
42
+ engine :
43
+ - name : $${ inputs.engine_name }}
44
+ version : $${ inputs.engine_version }}
45
+ appraisal : ${{ fromJSON(needs.matrix.outputs.matrix) }}
46
+ uses : ./.github/workflows/unit-test/appraisal.yml
47
+ with :
48
+ spec : ${{ matrix.spec }}
49
+ engine_name : ${{ matrix.engine.name }}
50
+ engine_version : ${{ matrix.engine.version }}
51
+ appraisal : ${{ matrix.appraisal }}
52
+
Original file line number Diff line number Diff line change
1
+ name : Spec
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ spec :
7
+ required : true
8
+ type : string
9
+
10
+ jobs :
11
+ matrix :
12
+ runs-on : ubuntu-latest
13
+ container :
14
+ image : " ruby:3.3"
15
+ name : Prepare matrix
16
+ outputs :
17
+ matrix : ${{ steps.matrix.outputs.matrix }}
18
+ steps :
19
+ - uses : actions/checkout@v4
20
+ - name : Compute matrix
21
+ id : matrix
22
+ run : |
23
+ matrix="$(ruby matrix.rb --json engines spec:${{ inputs.spec }})"
24
+ echo "${matrix}" | ruby -rjson -0777 -ne 'puts JSON.pretty_generate JSON.parse($_)'
25
+ echo "matrix=${matrix}" >> $GITHUB_OUTPUT
26
+
27
+ test :
28
+ runs-on : ubuntu-latest
29
+ name : " ${{ matrix.engine.name }}:${{ matrix.engine.version }} (${{ matrix.spec }})"
30
+ needs : matrix
31
+ strategy :
32
+ fail-fast : false
33
+ matrix :
34
+ spec :
35
+ - ${{ inputs.spec }}
36
+ engine : ${{ fromJSON(needs.matrix.outputs.matrix) }}
37
+ uses : ./.github/workflows/unit-test/engine.yml
38
+ with :
39
+ spec : ${{ matrix.spec }}
40
+ engine_name : ${{ matrix.engine.name }}
41
+ engine_version : ${{ matrix.engine.version }}
Original file line number Diff line number Diff line change
1
+ name : Unit Test
2
+
3
+ on :
4
+ push :
5
+
6
+ jobs :
7
+ matrix :
8
+ runs-on : ubuntu-latest
9
+ container :
10
+ image : " ruby:3.3"
11
+ name : Prepare matrix
12
+ outputs :
13
+ matrix : ${{ steps.matrix.outputs.matrix }}
14
+ steps :
15
+ - uses : actions/checkout@v4
16
+ - name : Compute matrix
17
+ id : matrix
18
+ run : |
19
+ matrix="$(ruby matrix.rb --json specs)"
20
+ echo "${matrix}" | ruby -rjson -0777 -ne 'puts JSON.pretty_generate JSON.parse($_)'
21
+ echo "matrix=${matrix}" >> $GITHUB_OUTPUT
22
+ test :
23
+ name : " ${{ matrix.spec }}"
24
+ needs : matrix
25
+ strategy :
26
+ fail-fast : false
27
+ matrix :
28
+ spec : ${{ needs.matrix.outputs.matrix }}
29
+ uses : ./.github/workflows/unit-test/spec.yml
30
+ with :
31
+ spec : ${{ matrix.spec }}
32
+
Original file line number Diff line number Diff line change 2
2
require 'json'
3
3
4
4
map = eval ( File . open ( 'Matrixfile' , 'r:UTF-8' ) . read )
5
+
5
6
ruby_to_jruby = {
6
7
'2.5' => [ '9.2' ] ,
7
8
'2.6' => [ '9.3' ] ,
50
51
selected_engine_version = nil
51
52
selected_spec_task = nil
52
53
selected_spec_appraisal = nil
54
+ output = nil
55
+ format = nil
53
56
ARGV . each do |arg |
54
57
case arg
55
58
when /^engine.name:(\S +)/ then selected_engine_name = $1
56
59
when /^engine.version:(\S +)/ then selected_engine_version = $1
57
- when /^spec.task:(\S +)/ then selected_spec_task = $1
58
- when /^spec.appraisal:(\S +)/ then selected_spec_appraisal = $1
60
+ when /^spec:(\S +)/ then selected_spec_task = $1
61
+ when /^appraisal:(\S *)/ then selected_spec_appraisal = $1
62
+ when 'engines' then output = 'engines'
63
+ when 'specs' then output = 'specs'
64
+ when 'appraisals' then output = 'appraisals'
65
+ when '--json' then format = 'json'
59
66
end
60
67
end
61
68
75
82
matrix . select! { |e | e [ :spec ] [ :appraisal ] == selected_spec_appraisal }
76
83
end
77
84
78
- puts ( JSON . dump ( { include : matrix } ) )
85
+ out = case output
86
+ when 'engines'
87
+ matrix . each_with_object ( [ ] ) { |e , a | a << e [ :engine ] } . uniq
88
+ when 'specs'
89
+ matrix . each_with_object ( [ ] ) { |e , a | a << e [ :spec ] [ :task ] } . uniq
90
+ when 'appraisals'
91
+ matrix . each_with_object ( [ ] ) { |e , a | a << e [ :spec ] [ :appraisal ] } . uniq
92
+ else
93
+ { include : matrix }
94
+ end
95
+
96
+ case format
97
+ when 'json'
98
+ puts ( JSON . dump ( out ) )
99
+ else
100
+ out . each { |e | puts e }
101
+ end
You can’t perform that action at this time.
0 commit comments