Skip to content

Commit 312599a

Browse files
committed
Speed up CI by splitting benchmark tests into separate jobs
Instead of having all benchmark tests run in a single job with a matrix, sequentially, we can split them into separate jobs. This allows us to run them in parallel, reducing the overall CI time.
1 parent b1a7224 commit 312599a

File tree

1 file changed

+83
-11
lines changed

1 file changed

+83
-11
lines changed

.github/workflows/test.yml

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
include:
16-
- ruby: ruby
17-
- ruby: head
18-
- ruby: truffleruby
19-
# TruffleRuby has randomly failed on different benchmarks
20-
continue-on-error: true
15+
ruby: [ruby, head, truffleruby]
2116
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
2217
steps:
2318
- uses: actions/checkout@v3
@@ -29,41 +24,118 @@ jobs:
2924
- name: Run tests
3025
run: rake test
3126

27+
benchmark-default:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
ruby: [ruby, head, truffleruby]
33+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
34+
steps:
35+
- uses: actions/checkout@v3
36+
- name: Set up Ruby
37+
uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: ${{ matrix.ruby }}
40+
3241
- name: Test run_benchmarks.rb
3342
run: ./run_benchmarks.rb
3443
env:
3544
WARMUP_ITRS: '1'
3645
MIN_BENCH_ITRS: '1'
3746
MIN_BENCH_TIME: '0'
38-
continue-on-error: ${{ matrix.continue-on-error || false }}
47+
continue-on-error: ${{ matrix.ruby == 'truffleruby' }}
48+
49+
benchmark-ractor:
50+
runs-on: ubuntu-latest
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
ruby: [ruby, head, truffleruby]
55+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
56+
steps:
57+
- uses: actions/checkout@v3
58+
- name: Set up Ruby
59+
uses: ruby/setup-ruby@v1
60+
with:
61+
ruby-version: ${{ matrix.ruby }}
3962

4063
- name: Test run_benchmarks.rb - Ractors
4164
run: ./run_benchmarks.rb --category=ractor
4265
env:
4366
WARMUP_ITRS: '1'
4467
MIN_BENCH_ITRS: '1'
4568
MIN_BENCH_TIME: '0'
46-
continue-on-error: ${{ matrix.continue-on-error || false }}
69+
continue-on-error: ${{ matrix.ruby == 'truffleruby' }}
70+
71+
benchmark-ractor-only:
72+
runs-on: ubuntu-latest
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
ruby: [ruby, head, truffleruby]
77+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
78+
steps:
79+
- uses: actions/checkout@v3
80+
- name: Set up Ruby
81+
uses: ruby/setup-ruby@v1
82+
with:
83+
ruby-version: ${{ matrix.ruby }}
4784

4885
- name: Test run_benchmarks.rb - Ractor Only
4986
run: ./run_benchmarks.rb --category=ractor-only
5087
env:
5188
WARMUP_ITRS: '1'
5289
MIN_BENCH_ITRS: '1'
5390
MIN_BENCH_TIME: '0'
54-
continue-on-error: ${{ matrix.continue-on-error || false }}
91+
continue-on-error: ${{ matrix.ruby == 'truffleruby' }}
92+
93+
benchmark-graph:
94+
runs-on: ubuntu-latest
95+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
96+
steps:
97+
- uses: actions/checkout@v3
98+
- name: Set up Ruby
99+
uses: ruby/setup-ruby@v1
100+
with:
101+
ruby-version: ruby
55102

56103
- name: Test run_benchmarks.rb --graph
57104
run: |
58105
sudo apt-get update
59106
sudo apt-get install -y --no-install-recommends libmagickwand-dev
60107
./run_benchmarks.rb --graph fib
61-
if: matrix.ruby == 'ruby'
62108
env:
63109
WARMUP_ITRS: '1'
64110
MIN_BENCH_ITRS: '1'
65111
MIN_BENCH_TIME: '0'
66112

113+
benchmark-run-once:
114+
runs-on: ubuntu-latest
115+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby-bench' }}
116+
steps:
117+
- uses: actions/checkout@v3
118+
- name: Set up Ruby
119+
uses: ruby/setup-ruby@v1
120+
with:
121+
ruby-version: head
122+
67123
- name: Test run_once.sh
68124
run: ./run_once.sh --yjit-stats benchmarks/railsbench/benchmark.rb
69-
if: matrix.ruby == 'head'
125+
126+
all-tests:
127+
runs-on: ubuntu-latest
128+
needs: [test, benchmark-default, benchmark-ractor, benchmark-ractor-only, benchmark-graph, benchmark-run-once]
129+
if: always()
130+
steps:
131+
- name: Check all job results
132+
run: |
133+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
134+
echo "One or more jobs failed"
135+
exit 1
136+
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
137+
echo "One or more jobs were cancelled"
138+
exit 1
139+
else
140+
echo "All jobs completed successfully"
141+
fi

0 commit comments

Comments
 (0)