1- name : Unit Test Template
1+ name : Unit Tests (Ruby version specific)
22
33on : # yamllint disable-line rule:truthy
44 workflow_call :
@@ -13,6 +13,9 @@ on: # yamllint disable-line rule:truthy
1313 alias :
1414 required : true
1515 type : string
16+ seed :
17+ required : false
18+ type : number
1619 outputs :
1720 lockfile :
1821 description : " The lockfile artifact"
@@ -21,11 +24,33 @@ on: # yamllint disable-line rule:truthy
2124 description : " The cache key for bundle"
2225 value : ${{ jobs.batch.outputs.cache-key }}
2326
27+ workflow_dispatch :
28+ inputs :
29+ engine :
30+ description : " `ruby` or `jruby`"
31+ required : true
32+ type : string
33+ version :
34+ description : " The version of the engine (2.x or 3.x for Ruby, 9.x or 10.x for JRuby)"
35+ required : true
36+ type : string
37+ alias :
38+ description : " The alias of the engine (e.g. `ruby-34` for Ruby 3.4)"
39+ required : true
40+ type : string
41+ seed :
42+ description : " The seed to reproduce a CI run"
43+ required : false
44+ type : number
45+
46+ permissions : {}
47+
2448jobs :
2549 batch :
2650 runs-on : ubuntu-24.04
2751 name : batch
2852 outputs :
53+ seed : " ${{ steps.set-batches.outputs.seed }}"
2954 batches : " ${{ steps.set-batches.outputs.batches }}"
3055 misc : " ${{ steps.set-batches.outputs.misc }}"
3156 cache-key : " ${{ steps.bundle-cache.outputs.cache-key }}"
@@ -43,20 +68,23 @@ jobs:
4368
4469 - id : set-batches
4570 name : Distribute tasks into batches
71+ env :
72+ CI_TEST_SEED : " ${{ inputs.seed || '' }}"
4673 run : |
4774 data=$(bundle exec rake github:generate_batches)
4875 echo "$data" | ruby -rjson -e 'puts JSON.pretty_generate(JSON.parse(STDIN.read))'
4976
5077 # Extract each key and set it as a separate output
78+ seed_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["seed"]')
5179 batches_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["batches"].to_json')
5280 misc_data=$(echo "$data" | ruby -rjson -e 'puts JSON.parse(STDIN.read)["misc"].to_json')
5381
54- echo "batches=$batches_data" >> "$GITHUB_OUTPUT"
55- echo "misc=$misc_data" >> "$GITHUB_OUTPUT"
82+ { echo "seed=$seed_data"; echo "batches=$batches_data"; echo "misc=$misc_data"; } >> "$GITHUB_OUTPUT"
5683 - name : Generate batch summary
57- run : bundle exec rake github:generate_batch_summary
5884 env :
5985 batches_json : " ${{ steps.set-batches.outputs.batches }}"
86+ CI_TEST_SEED : " ${{ steps.set-batches.outputs.seed }}"
87+ run : bundle exec rake github:generate_batch_summary
6088
6189 # `Initialize containers` step becomes quite heavily when many services are used.
6290 #
88116 timeout-minutes : 30
89117 env :
90118 BATCHED_TASKS : " ${{ toJSON(matrix.tasks) }}"
119+ CI_TEST_SEED : " ${{ needs.batch.outputs.seed }}"
91120 strategy :
92121 fail-fast : false
93122 matrix :
@@ -152,6 +181,7 @@ jobs:
152181 timeout-minutes : 30
153182 env :
154183 BATCHED_TASKS : " ${{ toJSON(matrix.tasks) }}"
184+ CI_TEST_SEED : " ${{ needs.batch.outputs.seed }}"
155185 strategy :
156186 fail-fast : false
157187 matrix :
0 commit comments