ruby_raider 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5fc3418c82e5a121ebecbc862acd716ded56f9d7dc49be670e9f0361917deb
4
- data.tar.gz: b7464935c9d32155bd30d80750c914e6fd3ba95b3db3d6ed8eb95d5461f86fcb
3
+ metadata.gz: 5141b6656f193315dce72afc9a7096ea48e63eed8a23c348cf38be0978627e90
4
+ data.tar.gz: b47a32013c49843ac2511f4bb0188adfcd50a83294fdbe692f8e483f3215ca67
5
5
  SHA512:
6
- metadata.gz: 827db06d8dab522391496aeedbff5e199119ac287e548241e1ce23bb9ff65616043c1626cb35226ce1230a8c154953c9eb0bc3f65d5a7abaa9ee323dfd76522d
7
- data.tar.gz: e37a2899b4e8f78c941dd0f570f2a5c2833a61cc74cb30e392cc7e53565f1df78374853b0fd73b38aeabb7d8849fd22210cf534e153f3c8d9664128bd1566b5a
6
+ metadata.gz: 4840894d57645404ac69faf2ebe7985e59b5df8e653ec8746fb40d23a45e082b0f2708b1d2cc275f7cfa3ce250a009dea61d2022ed6ca96f6c835ac36ed04bca
7
+ data.tar.gz: f0eee8de1a42d7ff1440ee7d6700c9d6ffa9370fe53a811b2c99ba03147eed8101edeff5a8e9df0849fe25fb5189d5fd34aab9e07b5ee0642d575d46739f487c
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ require:
2
2
  - rubocop-rspec
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 3.1.0
5
+ TargetRubyVersion: 3.2.0
6
6
 
7
7
  # Layout
8
8
  Layout/CaseIndentation:
data/RELEASE.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Release Notes
4
4
 
5
+ ### 3.4.0
6
+
7
+ - Generated RSpec projects with GitHub CI now include a `raider-comment` job that comments Raider test results on pull requests via `raider-reporter comment`. It runs after every test job, only on pull requests, and needs the `RAIDER_TOKEN` secret and `RAIDER_ENDPOINT` variable. Cucumber projects are unchanged.
8
+ - The job needs `contents: read`, `pull-requests: write` and `statuses: write` permissions; it reports a `raider/tests` status, and pull requests from forks are skipped.
9
+ - Generated Gemfiles now require `raider_reporter` `~> 0.3`.
10
+ - Ruby Raider now requires Ruby 3.2.0 or newer.
11
+
5
12
  ### 3.3.0
6
13
 
7
14
  - Generated RSpec projects now include `raider_reporter`: results are written to `raider-results/` and uploaded when `RAIDER_TOKEN` and `RAIDER_ENDPOINT` are set. Allure is still produced. Cucumber projects are unchanged.
@@ -81,3 +81,24 @@ jobs:
81
81
  PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82
82
  PUBLISH_BRANCH: gh-pages
83
83
  PUBLISH_DIR: allure-history
84
+
85
+ <%- unless framework == 'cucumber' -%>
86
+ raider-comment:
87
+ needs: [build]
88
+ if: always() && github.event_name == 'pull_request'
89
+ runs-on: ubuntu-latest
90
+ permissions:
91
+ contents: read
92
+ pull-requests: write
93
+ statuses: write
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: ruby/setup-ruby@v1
97
+ with: { ruby-version: 3.4.0, bundler-cache: true }
98
+ - name: Comment Raider results on the pull request
99
+ run: bundle exec raider-reporter comment
100
+ env:
101
+ RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
102
+ RAIDER_ENDPOINT: ${{ vars.RAIDER_ENDPOINT }}
103
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104
+ <%- end -%>
@@ -126,3 +126,24 @@ jobs:
126
126
  if-no-files-found: ignore
127
127
  <%- end -%>
128
128
  <%- end -%>
129
+
130
+ <%- unless cucumber? -%>
131
+ raider-comment:
132
+ needs: [<%= [('ios-tests' if ios? || cross_platform?), ('android-tests' if android? || cross_platform?)].compact.join(', ') %>]
133
+ if: always() && github.event_name == 'pull_request'
134
+ runs-on: ubuntu-latest
135
+ permissions:
136
+ contents: read
137
+ pull-requests: write
138
+ statuses: write
139
+ steps:
140
+ - uses: actions/checkout@v4
141
+ - uses: ruby/setup-ruby@v1
142
+ with: { ruby-version: 3.4.0, bundler-cache: true }
143
+ - name: Comment Raider results on the pull request
144
+ run: bundle exec raider-reporter comment
145
+ env:
146
+ RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
147
+ RAIDER_ENDPOINT: ${{ vars.RAIDER_ENDPOINT }}
148
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149
+ <%- end -%>
@@ -20,7 +20,7 @@ gem 'parallel_tests'
20
20
  gem 'rake'
21
21
  gem 'reek'
22
22
  <%- if rspec? -%>
23
- gem 'raider_reporter', '~> 0.2'
23
+ gem 'raider_reporter', '~> 0.3'
24
24
  gem 'rspec-retry'
25
25
  <%- end -%>
26
26
  gem '<%= framework %>'
data/lib/version CHANGED
@@ -1 +1 @@
1
- 3.3.0
1
+ 3.4.0
data/ruby_raider.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = 'agustin.pe94@gmail.com'
10
10
  s.homepage = 'https://github.com/RubyRaider/ruby_raider'
11
11
  s.license = 'MIT'
12
- s.required_ruby_version = '>= 3.1.0'
12
+ s.required_ruby_version = '>= 3.2.0'
13
13
  s.files = `git ls-files -z`.split("\x0")
14
14
  s.bindir = 'bin'
15
15
  s.executables << 'raider'
@@ -81,7 +81,7 @@ describe 'CI pipeline content' do
81
81
 
82
82
  it 'uploads raider-results as an artifact even on failure in every job' do
83
83
  uploads = steps.select { |step| step['uses'] == 'actions/upload-artifact@v4' }
84
- expect(uploads.size).to eq(YAML.safe_load(pipeline)['jobs'].size)
84
+ expect(uploads.size).to eq(YAML.safe_load(pipeline)['jobs'].except('raider-comment').size)
85
85
  uploads.each do |upload|
86
86
  expect(upload['with']['path']).to eq('raider-results/')
87
87
  expect(upload['if']).to eq('always()')
@@ -89,6 +89,54 @@ describe 'CI pipeline content' do
89
89
  end
90
90
  end
91
91
 
92
+ shared_examples 'github raider-comment job' do |project_name, file, test_jobs|
93
+ subject(:pipeline) { read_generated(project_name, ".github/workflows/#{file}") }
94
+
95
+ let(:jobs) { YAML.safe_load(pipeline)['jobs'] }
96
+ let(:job) { jobs['raider-comment'] }
97
+
98
+ it 'is a valid workflow with exactly the expected jobs' do
99
+ expect(jobs.keys).to match_array(test_jobs + ['raider-comment'])
100
+ end
101
+
102
+ it 'needs every test job' do
103
+ expect(job['needs']).to match_array(test_jobs)
104
+ end
105
+
106
+ it 'runs always, on pull requests only' do
107
+ expect(job['if']).to eq("always() && github.event_name == 'pull_request'")
108
+ expect(job['runs-on']).to eq('ubuntu-latest')
109
+ end
110
+
111
+ it 'has the least permissions required' do
112
+ expect(job['permissions']).to eq('contents' => 'read', 'pull-requests' => 'write', 'statuses' => 'write')
113
+ end
114
+
115
+ it 'checks out, sets up the same Ruby as the test jobs and comments' do
116
+ steps = job['steps']
117
+ expect(steps[0]).to eq('uses' => 'actions/checkout@v4')
118
+ expect(steps[1]['uses']).to eq('ruby/setup-ruby@v1')
119
+ test_ruby = jobs.values_at(*test_jobs).flat_map { |j| j['steps'] }
120
+ .find { |step| step['uses'] == 'ruby/setup-ruby@v1' }['with']['ruby-version']
121
+ expect(steps[1]['with']).to eq('ruby-version' => test_ruby, 'bundler-cache' => true)
122
+ expect(steps[2]).to eq('name' => 'Comment Raider results on the pull request',
123
+ 'run' => 'bundle exec raider-reporter comment',
124
+ 'env' => { 'RAIDER_TOKEN' => '${{ secrets.RAIDER_TOKEN }}',
125
+ 'RAIDER_ENDPOINT' => '${{ vars.RAIDER_ENDPOINT }}',
126
+ 'GITHUB_TOKEN' => '${{ secrets.GITHUB_TOKEN }}' })
127
+ expect(steps.size).to eq(3)
128
+ end
129
+ end
130
+
131
+ shared_examples 'github without raider-comment job' do |project_name, file|
132
+ subject(:pipeline) { read_generated(project_name, ".github/workflows/#{file}") }
133
+
134
+ it 'has no raider-comment job' do
135
+ expect(pipeline).not_to include('raider-comment')
136
+ expect(pipeline).not_to include('raider-reporter')
137
+ end
138
+ end
139
+
92
140
  shared_examples 'github without raider wiring' do |project_name, file|
93
141
  subject(:pipeline) { read_generated(project_name, ".github/workflows/#{file}") }
94
142
 
@@ -112,6 +160,7 @@ describe 'CI pipeline content' do
112
160
  include_examples 'github rspec pipeline', name
113
161
  include_examples 'github triggers', name, 'test_pipeline.yml'
114
162
  include_examples 'github raider wiring', name, 'test_pipeline.yml'
163
+ include_examples 'github raider-comment job', name, 'test_pipeline.yml', %w[build]
115
164
  include_examples 'github allure steps', name
116
165
  end
117
166
 
@@ -121,6 +170,7 @@ describe 'CI pipeline content' do
121
170
  include_examples 'github cucumber pipeline', name
122
171
  include_examples 'github triggers', name, 'test_pipeline.yml'
123
172
  include_examples 'github without raider wiring', name, 'test_pipeline.yml'
173
+ include_examples 'github without raider-comment job', name, 'test_pipeline.yml'
124
174
  include_examples 'github allure steps', name
125
175
  end
126
176
 
@@ -130,12 +180,17 @@ describe 'CI pipeline content' do
130
180
  include_examples 'github rspec pipeline', name
131
181
  include_examples 'github triggers', name, 'test_pipeline.yml'
132
182
  include_examples 'github raider wiring', name, 'test_pipeline.yml'
183
+ include_examples 'github raider-comment job', name, 'test_pipeline.yml', %w[build]
133
184
  include_examples 'github allure steps', name
134
185
  end
135
186
 
136
- %w[android ios cross_platform].each do |automation|
187
+ appium_jobs = { 'android' => %w[android-tests], 'ios' => %w[ios-tests],
188
+ 'cross_platform' => %w[ios-tests android-tests] }
189
+
190
+ appium_jobs.each do |automation, test_jobs|
137
191
  context "with rspec and #{automation}" do
138
192
  name = "#{FrameworkIndex::RSPEC}_#{automation}"
193
+ include_examples 'github raider-comment job', name, 'appium_pipeline.yml', test_jobs
139
194
  include_examples 'github triggers', name, 'appium_pipeline.yml'
140
195
  include_examples 'github raider wiring', name, 'appium_pipeline.yml'
141
196
  end
@@ -144,6 +199,7 @@ describe 'CI pipeline content' do
144
199
  name = "#{FrameworkIndex::CUCUMBER}_#{automation}"
145
200
  include_examples 'github triggers', name, 'appium_pipeline.yml'
146
201
  include_examples 'github without raider wiring', name, 'appium_pipeline.yml'
202
+ include_examples 'github without raider-comment job', name, 'appium_pipeline.yml'
147
203
  end
148
204
  end
149
205
  end
@@ -127,7 +127,7 @@ describe 'Gemfile content' do
127
127
  let(:gemfile) { read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'Gemfile') }
128
128
 
129
129
  it 'includes raider_reporter' do
130
- expect(gemfile).to include("gem 'raider_reporter', '~> 0.2'")
130
+ expect(gemfile).to include("gem 'raider_reporter', '~> 0.3'")
131
131
  end
132
132
 
133
133
  it 'keeps allure gems' do
@@ -104,6 +104,15 @@ describe 'End-to-End Project Generation and Execution' do
104
104
  expect(bundle_install(project)).to be true
105
105
  end
106
106
 
107
+ it 'resolves raider_reporter 0.3 from RubyGems and ships the raider-reporter executable', :aggregate_failures do
108
+ skip 'Bundle install failed' unless bundle_install(project)
109
+
110
+ expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.3\.\d+\)$/)
111
+ result = run_in_project(project, 'bundle exec raider-reporter --help', timeout: 60)
112
+ expect(result[:exit_code]).to eq(0), "STDOUT: #{result[:stdout]}\nSTDERR: #{result[:stderr]}"
113
+ expect(result[:stdout] + result[:stderr]).to include('raider-reporter comment')
114
+ end
115
+
107
116
  it 'runs generated RSpec tests successfully', :slow do
108
117
  skip 'Bundle install failed' unless bundle_install(project)
109
118
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
@@ -346,7 +346,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
346
346
  requirements:
347
347
  - - ">="
348
348
  - !ruby/object:Gem::Version
349
- version: 3.1.0
349
+ version: 3.2.0
350
350
  required_rubygems_version: !ruby/object:Gem::Requirement
351
351
  requirements:
352
352
  - - ">="