-
Notifications
You must be signed in to change notification settings - Fork 18
228 lines (197 loc) · 6.88 KB
/
Copy pathtest.yml
File metadata and controls
228 lines (197 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
---
name: Test
on:
push:
branches: [ master ]
paths:
- '**.gemfile'
- '**.rb'
- '.github/workflows/**'
- '.github/actions/**'
- 'Gemfile*'
- '!bin/**'
pull_request:
types: [ opened, synchronize, reopened, labeled ]
paths:
- '**.gemfile'
- '**.rb'
- '.github/workflows/**'
- '.github/actions/**'
- 'Gemfile*'
- '!bin/**'
schedule:
# Weekly full-suite drift check on master, quiet slot.
- cron: '0 6 * * 1'
workflow_dispatch:
env:
BUNDLE_GEMFILE: gemfiles/rails81_gems.rb
DEBIAN_FRONTEND: noninteractive
FERRUM_PROCESS_TIMEOUT: 40
JAVA_OPTS: -Xmn2g -Xms6g -Xmx6g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -Xss1m
-XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=256m
-XX:+UseCodeCacheFlushing
JRUBY_OPTS: --dev -J-Djruby.thread.pool.enabled=true
MALLOC_ARENA_MAX: 2
RUBY_GC_HEAP_FREE_SLOTS: 600000
RUBY_GC_HEAP_GROWTH_FACTOR: 1.1
RUBY_YJIT_ENABLE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Test that new contributors can run the tests directly after checkout.
test-minimal-setup:
name: Test with minimal setup
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: "4.0"
- run: bin/rake test
env:
SCREENSHOT_DRIVER: vips
functional-test:
name: Functional Test
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: "4.0"
cache-apt-packages: true
- run: bin/rake test
env:
COVERAGE: enabled
DISABLE_SKIP_TESTS: 1
SCREENSHOT_DRIVER: vips
- uses: ./.github/actions/upload-screenshots
if: failure()
with:
name: base-screenshots
pr-comment: 'true'
- name: Uploading Coverage Report
uses: actions/upload-artifact@v7
with:
name: coverage
retention-days: 1
path: coverage
matrix:
name: Test Ruby & Rails
# Off PRs by default (free-tier minutes): master, dispatch, weekly cron,
# or the 'full-ci' label.
if: >
github.ref == 'refs/heads/master' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule' ||
contains(github.event.pull_request.labels.*.name, 'full-ci')
needs: [ functional-test ]
runs-on: ubuntu-latest
# Must fit `max_attempts * timeout_minutes` below, plus ~1 min of setup,
# or the last attempt gets killed mid-run and the cell reports `cancelled`
# -- a dead gate. JRuby: 1 + 20 + 20 = 41. MRI: 1 + 4 + 4 = 9.
timeout-minutes: ${{ contains(matrix.ruby-version, 'jruby') && 41 || 9 }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
ruby-version: [ "4.0", "3.4", "3.3" ]
gemfile:
- rails71_gems.rb
- rails72_gems.rb
- rails80_gems.rb
- rails81_gems.rb
experimental: [ false ]
exclude:
# Rails 7.1 does not support Ruby 4.0 -- its gemspec floor of 2.7.0
# has no upper bound, but 7.1 predates Ruby 4 by years (#288).
- ruby-version: "4.0"
gemfile: rails71_gems.rb
experimental: false
include:
- ruby-version: "4.0"
gemfile: edge_gems.rb
experimental: true
# One cell: JRuby's differences (no Kernel#fork, thread semantics,
# the FFI/vips path) are JVM-level, not Rails-level.
- ruby-version: jruby-10.1
gemfile: rails81_gems.rb
experimental: false
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
# JRuby is the only place ruby-vips' FFI path runs on a non-MRI engine.
# Test Drivers covers both backends on CRuby.
SCREENSHOT_DRIVER: ${{ contains(matrix.ruby-version, 'jruby') && 'vips' || 'chunky_png' }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-cache-version: ${{ matrix.ruby-version }}-${{ matrix.gemfile }}-1
cache-apt-packages: true
- name: Run tests (with 1 retry)
uses: nick-fields/retry@v4
with:
# Measured, not chosen: slowest attempt is ~880s JRuby, ~146s MRI.
# Both have timed out before when the suite grew into them -- when
# that happens, re-measure and raise this AND timeout-minutes above.
timeout_minutes: ${{ contains(matrix.ruby-version, 'jruby') && 20 || 4 }}
# Exists only for the intermittent JRuby teardown hang (#244).
# Once that is fixed, drop to 1 and halve the JRuby bill.
max_attempts: 2
command: bin/rake test
matrix-screenshot-driver:
name: Test Drivers
# Off PRs by default, same triggers as the matrix above.
if: >
github.ref == 'refs/heads/master' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule' ||
contains(github.event.pull_request.labels.*.name, 'full-ci')
needs: [ 'functional-test' ]
strategy:
matrix:
capybara-driver: [ selenium_headless, selenium_chrome_headless, cuprite ]
screenshot-driver: [ vips, chunky_png ]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: "4.0"
cache-apt-packages: ${{ matrix.screenshot-driver == 'vips' }}
- name: Cache Selenium
uses: actions/cache@v6
with:
path: ~/.cache/selenium
key: ${{ runner.os }}-selenium-${{ matrix.capybara-driver }}
- run: bin/rake test:integration
env:
CAPYBARA_DRIVER: ${{ matrix.capybara-driver }}
SCREENSHOT_DRIVER: ${{ matrix.screenshot-driver }}
- uses: ./.github/actions/upload-screenshots
if: failure()
with:
name: screenshots-${{ matrix.capybara-driver }}-${{ matrix.screenshot-driver }}
test-report-upload:
name: Test Report Upload
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: "4.0"
cache-apt-packages: true
- name: Generate sample report
run: bin/rake 'report:sample[embed]'
- uses: ./.github/actions/upload-screenshots
with:
name: test-report