git_lib 1.2.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +27 -0
- data/.github/workflows/gem_release.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/lib/git/git.rb +14 -6
- data/lib/git/git_commit.rb +3 -2
- data/lib/git/git_test_helpers.rb +3 -2
- data/lib/git/version.rb +1 -1
- data/spec/lib/git/git_branch_spec.rb +1 -1
- data/spec/lib/git/git_commit_spec.rb +24 -0
- data/spec/lib/git/git_conflict_spec.rb +1 -1
- data/spec/lib/git/git_error_spec.rb +1 -1
- data/spec/lib/git/git_spec.rb +25 -11
- data/spec/spec_helper.rb +8 -0
- metadata +9 -8
- data/.jenkins/Jenkinsfile +0 -72
- data/.jenkins/ruby_build_pod.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83b697a51aa8d99736c92879bb28d0e59f8635e7d32a9e0d9de5c9b6a0a2dc9
|
4
|
+
data.tar.gz: 62649c6cbe804f091acc15cf96e47cbb13521afd44a4cad571e378cbdd051719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a4caae1a2a43f7602ff8b2b0d5d4db07565e2702cc497aabd781e95fff12a845d9568f33ea91db142a0caf8644b6fb7e024fd4cf3bcbf78a1f19a01519f8062
|
7
|
+
data.tar.gz: 3556c067c8d47dcbb0bf641800cf8f095d3fa994830c57169792fa85b6f04dd0720b87a3d8c8bd724d622054dc3c4efb0361ff0384909555109cb38d1abb7ff8
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
name: Build
|
3
|
+
on: [push]
|
4
|
+
jobs:
|
5
|
+
tests:
|
6
|
+
name: Unit Tests
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [2.5, 2.6]
|
12
|
+
gemfile:
|
13
|
+
- Gemfile
|
14
|
+
- gemfiles/rails_4.gemfile
|
15
|
+
- gemfiles/rails_5.gemfile
|
16
|
+
- gemfiles/rails_6.gemfile
|
17
|
+
env:
|
18
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler: 1.17.3
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Unit tests
|
27
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [2.1.0] - 2021-12-13
|
8
|
+
### Changed
|
9
|
+
- Changed `commit_diff_refs` to handle the `nil` case for `ancestor_ref`
|
10
|
+
|
11
|
+
## [2.0.0] - 2021-08-24
|
12
|
+
### Changed
|
13
|
+
- Add required `repository:` to `GitCommit`.
|
14
|
+
|
7
15
|
## [1.2.0] - 2020-07-13
|
8
16
|
### Added
|
9
17
|
- Add support for Rails 5 and 6.
|
@@ -20,5 +28,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
|
|
20
28
|
- Add magic frozen_string_literal: true comment everywhere.
|
21
29
|
- Clean up Rakefile.
|
22
30
|
|
31
|
+
[2.1.0]: https://github.com/Invoca/git_lib/compare/v2.0.0...v2.1.0
|
32
|
+
[2.0.0]: https://github.com/Invoca/git_lib/compare/v1.2.0...v2.0.0
|
23
33
|
[1.2.0]: https://github.com/Invoca/git_lib/compare/v1.1.1...v1.2.0
|
24
34
|
[1.1.1]: https://github.com/Invoca/git_lib/compare/v1.1.0...v1.1.1
|
data/Gemfile.lock
CHANGED
data/lib/git/git.rb
CHANGED
@@ -150,20 +150,28 @@ module Git
|
|
150
150
|
raw_output.split("\n")
|
151
151
|
end
|
152
152
|
|
153
|
+
def sha_list_for_ref_range(ref, ancestor_ref, fetch: false)
|
154
|
+
commit_diff_refs(ref, ancestor_ref, fetch: fetch).map(&:sha)
|
155
|
+
end
|
156
|
+
|
153
157
|
def commit_diff_refs(ref, ancestor_ref, fetch: false)
|
154
158
|
if fetch
|
155
159
|
fetch_all
|
156
160
|
end
|
157
|
-
|
161
|
+
|
162
|
+
ref_prefix = 'origin/' unless self.class.is_git_sha?(ref)
|
158
163
|
ancestor_ref_prefix = 'origin/' unless self.class.is_git_sha?(ancestor_ref)
|
159
164
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
165
|
+
sha_range = if ancestor_ref
|
166
|
+
"#{ancestor_ref_prefix}#{Shellwords.escape(ancestor_ref)}..#{ref_prefix}#{Shellwords.escape(ref)}"
|
167
|
+
else
|
168
|
+
"#{ref_prefix}#{Shellwords.escape(ref)}"
|
169
|
+
end
|
170
|
+
|
171
|
+
raw_output = execute("log --format=%H\t%an\t%ae\t%aI\t%s --no-color #{sha_range}")
|
164
172
|
raw_output.split("\n").map do |row|
|
165
173
|
commit_data = row.split("\t")
|
166
|
-
GitCommit.new(commit_data[0], commit_data[4], DateTime.iso8601(commit_data[3]), commit_data[1], commit_data[2])
|
174
|
+
GitCommit.new(commit_data[0], commit_data[4], DateTime.iso8601(commit_data[3]), commit_data[1], commit_data[2], repository_name: @repository_name)
|
167
175
|
end
|
168
176
|
end
|
169
177
|
|
data/lib/git/git_commit.rb
CHANGED
@@ -2,14 +2,15 @@
|
|
2
2
|
|
3
3
|
module Git
|
4
4
|
class GitCommit
|
5
|
-
attr_reader :sha, :message, :commit_date, :author_name, :author_email
|
5
|
+
attr_reader :repository_name, :sha, :message, :commit_date, :author_name, :author_email
|
6
6
|
|
7
|
-
def initialize(sha, message, commit_date, author_name, author_email)
|
7
|
+
def initialize(sha, message, commit_date, author_name, author_email, repository_name:)
|
8
8
|
@sha = sha
|
9
9
|
@message = message
|
10
10
|
@commit_date = commit_date
|
11
11
|
@author_email = author_email
|
12
12
|
@author_name = author_name
|
13
|
+
@repository_name = repository_name
|
13
14
|
end
|
14
15
|
|
15
16
|
def to_s
|
data/lib/git/git_test_helpers.rb
CHANGED
@@ -23,12 +23,13 @@ module Git
|
|
23
23
|
GitConflict.new(repository_name, branch_a_name, branch_b_name, file_list)
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.create_commit(
|
26
|
+
def self.create_commit(repository_name: 'repository',
|
27
|
+
sha: '1234567890123456789012345678901234567890',
|
27
28
|
message: 'Commit message',
|
28
29
|
author_name: 'Author Name',
|
29
30
|
author_email: 'author@email.com',
|
30
31
|
commit_date: Time.current)
|
31
|
-
GitCommit.new(sha, message, commit_date, author_name, author_email)
|
32
|
+
GitCommit.new(sha, message, commit_date, author_name, author_email, repository_name: repository_name)
|
32
33
|
end
|
33
34
|
|
34
35
|
def self.create_sha
|
data/lib/git/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
require_relative '../../../lib/git/git_branch.rb'
|
5
5
|
|
6
|
-
describe 'Git::GitBranch' do
|
6
|
+
RSpec.describe 'Git::GitBranch' do
|
7
7
|
it 'can be created' do
|
8
8
|
last_modified_date = Time.current
|
9
9
|
branch = Git::GitBranch.new('repository_name', 'name', last_modified_date, 'author_name', 'author@email.com')
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require_relative '../../../lib/git/git_commit.rb'
|
5
|
+
|
6
|
+
RSpec.describe Git::GitCommit do
|
7
|
+
let(:sha) { 'aabb2345' }
|
8
|
+
let(:message) { 'TECH-1234: update comments' }
|
9
|
+
let(:commit_date) { '2021-08-23 10:03:00 -0700' }
|
10
|
+
let(:author_name) { 'John Doe' }
|
11
|
+
let(:author_email) { 'john@doe.com' }
|
12
|
+
let(:repository_name) { 'repository_name' }
|
13
|
+
|
14
|
+
it 'can be created' do
|
15
|
+
commit = Git::GitCommit.new(sha, message, commit_date, author_name, author_email, repository_name: repository_name)
|
16
|
+
|
17
|
+
expect(commit.sha).to eq(sha)
|
18
|
+
expect(commit.message).to eq(message)
|
19
|
+
expect(commit.commit_date).to eq(commit_date)
|
20
|
+
expect(commit.author_name).to eq(author_name)
|
21
|
+
expect(commit.author_email).to eq(author_email)
|
22
|
+
expect(commit.repository_name).to eq(repository_name)
|
23
|
+
end
|
24
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
require_relative '../../../lib/git/git_conflict.rb'
|
5
5
|
|
6
|
-
describe 'Git::GitConflict' do
|
6
|
+
RSpec.describe 'Git::GitConflict' do
|
7
7
|
it 'can be created' do
|
8
8
|
conflict = Git::GitConflict.new('repository_name', 'branch_a', 'branch_b', ['file1', 'file2'])
|
9
9
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
require_relative '../../../lib/git/git_error.rb'
|
5
5
|
|
6
|
-
describe 'Git::GitError' do
|
6
|
+
RSpec.describe 'Git::GitError' do
|
7
7
|
it 'can be raised' do
|
8
8
|
expect { raise Git::GitError.new('command', 200, 'error_message') }.to \
|
9
9
|
raise_exception(Git::GitError, "Git command command failed with exit code 200. Message:\nerror_message")
|
data/spec/lib/git/git_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
require_relative '../../../lib/git/git.rb'
|
5
5
|
|
6
6
|
# rubocop:disable Metrics/LineLength
|
7
|
-
describe 'Git::Git' do
|
7
|
+
RSpec.describe 'Git::Git' do
|
8
8
|
include FakeFS::SpecHelpers
|
9
9
|
|
10
10
|
def create_mock_open_status(status)
|
@@ -28,15 +28,17 @@ describe 'Git::Git' do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
let(:repository_name) { 'repository_name' }
|
32
|
+
|
31
33
|
it 'can be created' do
|
32
|
-
git = Git::Git.new(
|
34
|
+
git = Git::Git.new(repository_name)
|
33
35
|
|
34
36
|
expect(git.repository_url).to eq('git@github.com:repository_name.git')
|
35
37
|
expect(git.repository_path).to eq('/tmp/git/repository_name')
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'can be created with a different cache path' do
|
39
|
-
git = Git::Git.new(
|
41
|
+
git = Git::Git.new(repository_name, git_cache_path: './mycache')
|
40
42
|
|
41
43
|
expect(git.repository_url).to eq('git@github.com:repository_name.git')
|
42
44
|
expect(git.repository_path).to eq('./mycache/repository_name')
|
@@ -44,7 +46,7 @@ describe 'Git::Git' do
|
|
44
46
|
|
45
47
|
context 'with a git repository' do
|
46
48
|
before do
|
47
|
-
@git = Git::Git.new(
|
49
|
+
@git = Git::Git.new(repository_name)
|
48
50
|
end
|
49
51
|
|
50
52
|
it 'can execute a command' do
|
@@ -145,21 +147,21 @@ describe 'Git::Git' do
|
|
145
147
|
|
146
148
|
branch_list = []
|
147
149
|
branch_list << Git::GitBranch.new(
|
148
|
-
|
150
|
+
repository_name,
|
149
151
|
'test_1',
|
150
152
|
DateTime.iso8601('2015-10-19T17:58:24-0700'),
|
151
153
|
'Nicholas Ellis',
|
152
154
|
'nellis@invoca.com'
|
153
155
|
)
|
154
156
|
branch_list << Git::GitBranch.new(
|
155
|
-
|
157
|
+
repository_name,
|
156
158
|
'test_build',
|
157
159
|
DateTime.iso8601('2015-10-19T15:03:22-0700'),
|
158
160
|
'Bob Smith',
|
159
161
|
'bob@invoca.com'
|
160
162
|
)
|
161
163
|
branch_list << Git::GitBranch.new(
|
162
|
-
|
164
|
+
repository_name,
|
163
165
|
'test_build_b',
|
164
166
|
DateTime.iso8601('2015-10-19T16:52:40-0700'),
|
165
167
|
'Nicholas Ellis',
|
@@ -186,7 +188,7 @@ describe 'Git::Git' do
|
|
186
188
|
)
|
187
189
|
|
188
190
|
conflict = Git::GitConflict.new(
|
189
|
-
|
191
|
+
repository_name,
|
190
192
|
'91/eb/WEB-1723_Ringswitch_DB_Conn_Loss',
|
191
193
|
'85/t/trello_adwords_dashboard_tiles_auto_adjust_font_size',
|
192
194
|
['test/workers/adwords_detail_worker_test.rb', 'pegasus/backdraft/pegasus_dashboard/spec/views/call_cost_tile_spec.js']
|
@@ -215,7 +217,7 @@ describe 'Git::Git' do
|
|
215
217
|
expect(@git).to receive(:reset)
|
216
218
|
|
217
219
|
conflict = Git::GitConflict.new(
|
218
|
-
|
220
|
+
repository_name,
|
219
221
|
'91/eb/WEB-1723_Ringswitch_DB_Conn_Loss',
|
220
222
|
'85/t/trello_adwords_dashboard_tiles_auto_adjust_font_size',
|
221
223
|
[
|
@@ -377,8 +379,8 @@ describe 'Git::Git' do
|
|
377
379
|
it 'can diff a branch' do
|
378
380
|
mocked_output = ["efd778098239838c165ffab2f12ad293f32824c8\tAuthor 1\tauthor1@email.com\t2016-07-14T10:09:45-07:00\tMerge branch 'production'\n",
|
379
381
|
"667f3e5347c48c04663209682642fd8d6d93fde2\tAuthor 2\tauthor2@email.com\t2016-07-14T16:46:35-07:00\tMerge pull request #5584 from Owner/repo/dimension_repair\n"].join
|
380
|
-
expected_array = [Git::GitCommit.new('efd778098239838c165ffab2f12ad293f32824c8', "Merge branch 'production'", nil, 'Author 1', 'author1@email.com'),
|
381
|
-
Git::GitCommit.new('667f3e5347c48c04663209682642fd8d6d93fde2', 'Merge pull request #5584 from Owner/repo/dimension_repair', nil, 'Author 2', 'author2@email.com')]
|
382
|
+
expected_array = [Git::GitCommit.new('efd778098239838c165ffab2f12ad293f32824c8', "Merge branch 'production'", nil, 'Author 1', 'author1@email.com', repository_name: repository_name),
|
383
|
+
Git::GitCommit.new('667f3e5347c48c04663209682642fd8d6d93fde2', 'Merge pull request #5584 from Owner/repo/dimension_repair', nil, 'Author 2', 'author2@email.com', repository_name: repository_name)]
|
382
384
|
mock_execute(
|
383
385
|
mocked_output,
|
384
386
|
1,
|
@@ -424,6 +426,18 @@ describe 'Git::Git' do
|
|
424
426
|
)
|
425
427
|
@git.commit_diff_refs('branch`name', 'ancestor`_branch')
|
426
428
|
end
|
429
|
+
|
430
|
+
it 'can get a list of shas given start and end refs' do
|
431
|
+
mocked_output = ["efd778098239838c165ffab2f12ad293f32824c8\tAuthor 1\tauthor1@email.com\t2016-07-14T10:09:45-07:00\tMerge branch 'production'\n",
|
432
|
+
"667f3e5347c48c04663209682642fd8d6d93fde2\tAuthor 2\tauthor2@email.com\t2016-07-14T16:46:35-07:00\tMerge pull request #5584 from Owner/repo/dimension_repair\n"].join
|
433
|
+
expected_array = ["efd778098239838c165ffab2f12ad293f32824c8", "667f3e5347c48c04663209682642fd8d6d93fde2"]
|
434
|
+
mock_execute(
|
435
|
+
mocked_output,
|
436
|
+
1,
|
437
|
+
expected_command: "/usr/bin/git log --format=%H\t%an\t%ae\t%aI\t%s --no-color efd778098239838c165ffab2f12ad293f32824c8..667f3e5347c48c04663209682642fd8d6d93fde2"
|
438
|
+
)
|
439
|
+
expect(@git.sha_list_for_ref_range("667f3e5347c48c04663209682642fd8d6d93fde2", "efd778098239838c165ffab2f12ad293f32824c8")).to eq(expected_array)
|
440
|
+
end
|
427
441
|
end
|
428
442
|
|
429
443
|
describe 'get_current_branch_name' do
|
data/spec/spec_helper.rb
CHANGED
@@ -7,14 +7,22 @@ require 'pp'
|
|
7
7
|
require 'fakefs/spec_helpers'
|
8
8
|
require 'rspec_junit_formatter'
|
9
9
|
require 'climate_control'
|
10
|
+
require 'rspec/support/object_formatter'
|
10
11
|
|
11
12
|
RSpec.configure do |config|
|
12
13
|
config.add_formatter RspecJunitFormatter, ENV['JUNIT_OUTPUT'] || 'spec/reports/rspec.xml'
|
14
|
+
RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 2_000
|
15
|
+
|
16
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
17
|
+
config.disable_monkey_patching!
|
18
|
+
|
19
|
+
config.filter_run_when_matching :focus
|
13
20
|
|
14
21
|
# Enable flags like --only-failures and --next-failure
|
15
22
|
config.example_status_persistence_file_path = "spec/reports/.rspec_status"
|
16
23
|
|
17
24
|
config.expect_with :rspec do |expectations|
|
25
|
+
expectations.syntax = :expect
|
18
26
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
19
27
|
end
|
20
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7'
|
33
|
-
description:
|
33
|
+
description:
|
34
34
|
email:
|
35
35
|
- development@invoca.com
|
36
36
|
executables: []
|
@@ -38,10 +38,9 @@ extensions: []
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
40
|
- ".dependabot/config.yml"
|
41
|
+
- ".github/workflows/build.yml"
|
41
42
|
- ".github/workflows/gem_release.yml"
|
42
43
|
- ".gitignore"
|
43
|
-
- ".jenkins/Jenkinsfile"
|
44
|
-
- ".jenkins/ruby_build_pod.yml"
|
45
44
|
- ".rspec"
|
46
45
|
- ".rubocop.yml"
|
47
46
|
- ".ruby-version"
|
@@ -65,6 +64,7 @@ files:
|
|
65
64
|
- lib/git/version.rb
|
66
65
|
- lib/git_lib.rb
|
67
66
|
- spec/lib/git/git_branch_spec.rb
|
67
|
+
- spec/lib/git/git_commit_spec.rb
|
68
68
|
- spec/lib/git/git_conflict_spec.rb
|
69
69
|
- spec/lib/git/git_error_spec.rb
|
70
70
|
- spec/lib/git/git_spec.rb
|
@@ -73,7 +73,7 @@ homepage: https://github.com/Invoca/git_lib
|
|
73
73
|
licenses: []
|
74
74
|
metadata:
|
75
75
|
allowed_push_host: https://rubygems.org
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -89,11 +89,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubygems_version: 3.0.1
|
92
|
-
signing_key:
|
92
|
+
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Git wrapper library.
|
95
95
|
test_files:
|
96
96
|
- spec/lib/git/git_branch_spec.rb
|
97
|
+
- spec/lib/git/git_commit_spec.rb
|
97
98
|
- spec/lib/git/git_conflict_spec.rb
|
98
99
|
- spec/lib/git/git_error_spec.rb
|
99
100
|
- spec/lib/git/git_spec.rb
|
data/.jenkins/Jenkinsfile
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
#!/usr/bin/groovy
|
2
|
-
@Library('jenkins-pipeline@v0.4.5')
|
3
|
-
import com.invoca.docker.*;
|
4
|
-
|
5
|
-
pipeline {
|
6
|
-
agent {
|
7
|
-
kubernetes {
|
8
|
-
defaultContainer "ruby"
|
9
|
-
yamlFile ".jenkins/ruby_build_pod.yml"
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
environment {
|
14
|
-
GITHUB_TOKEN = credentials('github_token')
|
15
|
-
BUNDLE_GEM__FURY__IO = credentials('gemfury_deploy_token')
|
16
|
-
}
|
17
|
-
|
18
|
-
stages {
|
19
|
-
stage('Setup') {
|
20
|
-
steps {
|
21
|
-
updateGitHubStatus('clean-build', 'pending', 'Running unit tests...')
|
22
|
-
sh 'bundle install'
|
23
|
-
sh 'bundle exec appraisal install'
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
stage('Appraisals') {
|
28
|
-
parallel {
|
29
|
-
stage('Current') {
|
30
|
-
environment { JUNIT_OUTPUT = 'spec/reports/current/rspec.xml' }
|
31
|
-
steps { sh 'bundle exec rspec' }
|
32
|
-
post { always { junit JUNIT_OUTPUT } }
|
33
|
-
}
|
34
|
-
|
35
|
-
stage('Rails 4') {
|
36
|
-
environment { JUNIT_OUTPUT = 'spec/reports/rails-4/rspec.xml' }
|
37
|
-
steps { sh 'bundle exec appraisal rails-4 rspec' }
|
38
|
-
post { always { junit JUNIT_OUTPUT } }
|
39
|
-
}
|
40
|
-
|
41
|
-
stage('Rails 5') {
|
42
|
-
environment { JUNIT_OUTPUT = 'spec/reports/rails-5/rspec.xml' }
|
43
|
-
steps { sh 'bundle exec appraisal rails-5 rspec' }
|
44
|
-
post { always { junit JUNIT_OUTPUT } }
|
45
|
-
}
|
46
|
-
|
47
|
-
stage('Rails 6') {
|
48
|
-
environment { JUNIT_OUTPUT = 'spec/reports/rails-6/rspec.xml' }
|
49
|
-
steps { sh 'bundle exec appraisal rails-6 rspec' }
|
50
|
-
post { always { junit JUNIT_OUTPUT } }
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
post {
|
57
|
-
success { updateGitHubStatus('clean-build', 'success', 'Unit tests passed') }
|
58
|
-
failure { updateGitHubStatus('clean-build', 'failure', 'Unit tests failed') }
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
void updateGitHubStatus(String context, String status, String description) {
|
63
|
-
gitHubStatus([
|
64
|
-
repoSlug: 'Invoca/git_lib',
|
65
|
-
sha: env.GIT_COMMIT,
|
66
|
-
description: description,
|
67
|
-
context: context,
|
68
|
-
targetURL: env.RUN_DISPLAY_URL,
|
69
|
-
token: env.GITHUB_TOKEN,
|
70
|
-
status: status
|
71
|
-
])
|
72
|
-
}
|
data/.jenkins/ruby_build_pod.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
apiVersion: v1
|
3
|
-
kind: Pod
|
4
|
-
metadata:
|
5
|
-
labels:
|
6
|
-
jenkins/git-lib: 'true'
|
7
|
-
namespace: jenkins
|
8
|
-
name: git-lib
|
9
|
-
spec:
|
10
|
-
containers:
|
11
|
-
- name: ruby
|
12
|
-
image: ruby:2.6.1
|
13
|
-
tty: true
|
14
|
-
resources:
|
15
|
-
requests:
|
16
|
-
memory: "100Mi"
|
17
|
-
command:
|
18
|
-
- cat
|
19
|
-
|