fast_ci 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bcf8f013e9598e2122841f30d951528519bffa648cfcf7c7872642ebd00d351
4
- data.tar.gz: 72915e82ca7728225880a297bd59d44f1bf70f75086fb74245ae0ffef21e4e21
3
+ metadata.gz: 57c532c3a32c2b2041464a467a9c5eb8763bc0600852c02a99edaf87613d605b
4
+ data.tar.gz: c832ddab7a59ef2b9ceda44d2416c3503608f98e5ee6dd8d3b5dc088dc4d614b
5
5
  SHA512:
6
- metadata.gz: 775e9c9368f928d4d8fb0e260f2a9d2909bbc132a038673b561ea5dd966c1e220dbbeb313157cc32ba966af28ab490b14643e1626087d24ca67f37247aa4c02c
7
- data.tar.gz: 505db9f73edbbcced7b53e8844b6eb967a00c24a4d3dfb04d7f551a0a626aba4063c76795739452ff60c0112dd6c20a2f5980de0999ca7cce507d082feb62861
6
+ metadata.gz: 11791ce2eb64178e01226a08e6a8a22d8005302cb466199b8f8306e849c745d92d8ccd972d0fcd25893052a0709babd0670111f0e3c02f912cef8e3c08ff9bfa
7
+ data.tar.gz: 1501c71e2460a3eac347d0a2fff28cac8e2bced99772c29faab08fc1c3d3af6c6d5d6b9d89c0a43ea0e6e0074b678ed088489d0ac470f4a86dcafa4c164e79b2
@@ -0,0 +1,26 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ - master
6
+
7
+ pull_request:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ ruby:
16
+ - 3.0.1
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
25
+ - name: Run the default task
26
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
1
4
  Style/StringLiterals:
2
5
  Enabled: true
3
6
  EnforcedStyle: double_quotes
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at you@example.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
5
7
  # Specify your gem's dependencies in fast_ci.gemspec
6
8
  gemspec
7
9
 
@@ -9,4 +11,4 @@ gem "rake", "~> 13.0"
9
11
 
10
12
  gem "rspec", "~> 3.0"
11
13
 
12
- gem "rubocop", "~> 1.7"
14
+ gem "async-websocket", github: "socketry/async-websocket", ref: "a63151d0759edde5ca5cd9ffa0414d9f2e295ee8"
data/Gemfile.lock CHANGED
@@ -1,12 +1,47 @@
1
+ GIT
2
+ remote: https://github.com/socketry/async-websocket
3
+ revision: a63151d0759edde5ca5cd9ffa0414d9f2e295ee8
4
+ ref: a63151d0759edde5ca5cd9ffa0414d9f2e295ee8
5
+ specs:
6
+ async-websocket (0.19.0)
7
+ async-http (~> 0.54)
8
+ async-io (~> 1.23)
9
+ protocol-websocket (~> 0.7.0)
10
+
1
11
  PATH
2
12
  remote: .
3
13
  specs:
4
- fast_ci (0.1.0)
5
- async-websocket (~> 0.19)
14
+ fast_ci (1.0.0)
15
+ async-websocket (<= 0.20.0)
16
+ brakeman (>= 5.4.1)
17
+ console (~> 1.10.0)
18
+ minitest-rails (>= 5.1)
19
+ rubycritic (>= 4.1.0)
6
20
 
7
21
  GEM
8
22
  remote: https://rubygems.org/
9
23
  specs:
24
+ actionpack (6.1.7.8)
25
+ actionview (= 6.1.7.8)
26
+ activesupport (= 6.1.7.8)
27
+ rack (~> 2.0, >= 2.0.9)
28
+ rack-test (>= 0.6.3)
29
+ rails-dom-testing (~> 2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
31
+ actionview (6.1.7.8)
32
+ activesupport (= 6.1.7.8)
33
+ builder (~> 3.1)
34
+ erubi (~> 1.4)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
37
+ activesupport (6.1.7.8)
38
+ concurrent-ruby (~> 1.0, >= 1.0.2)
39
+ i18n (>= 1.6, < 2)
40
+ minitest (>= 5.1)
41
+ tzinfo (~> 2.0)
42
+ zeitwerk (~> 2.3)
43
+ addressable (2.8.7)
44
+ public_suffix (>= 2.0.2, < 7.0)
10
45
  ast (2.4.2)
11
46
  async (1.30.1)
12
47
  console (~> 1.10)
@@ -19,26 +54,65 @@ GEM
19
54
  protocol-http (~> 0.22.0)
20
55
  protocol-http1 (~> 0.14.0)
21
56
  protocol-http2 (~> 0.14.0)
22
- async-io (1.32.2)
57
+ async-io (1.33.0)
23
58
  async
24
- async-pool (0.3.8)
59
+ async-pool (0.3.9)
25
60
  async (>= 1.25)
26
- async-websocket (0.19.0)
27
- async-http (~> 0.54)
28
- async-io (~> 1.23)
29
- protocol-websocket (~> 0.7.0)
61
+ axiom-types (0.1.1)
62
+ descendants_tracker (~> 0.0.4)
63
+ ice_nine (~> 0.11.0)
64
+ thread_safe (~> 0.3, >= 0.3.1)
65
+ brakeman (5.4.1)
66
+ builder (3.3.0)
67
+ childprocess (5.1.0)
68
+ logger (~> 1.5)
30
69
  coderay (1.1.3)
31
- console (1.13.1)
70
+ coercible (1.0.0)
71
+ descendants_tracker (~> 0.0.1)
72
+ concurrent-ruby (1.3.4)
73
+ console (1.10.2)
32
74
  fiber-local
33
- diff-lcs (1.4.4)
75
+ crass (1.0.6)
76
+ descendants_tracker (0.0.4)
77
+ thread_safe (~> 0.3, >= 0.3.1)
78
+ diff-lcs (1.5.0)
79
+ docile (1.4.1)
80
+ equalizer (0.0.11)
81
+ erubi (1.13.0)
34
82
  fiber-local (1.0.0)
83
+ flay (2.13.3)
84
+ erubi (~> 1.10)
85
+ path_expander (~> 1.0)
86
+ ruby_parser (~> 3.0)
87
+ sexp_processor (~> 4.0)
88
+ flog (4.8.0)
89
+ path_expander (~> 1.0)
90
+ ruby_parser (~> 3.1, > 3.1.0)
91
+ sexp_processor (~> 4.8)
92
+ i18n (1.14.6)
93
+ concurrent-ruby (~> 1.0)
94
+ ice_nine (0.11.2)
95
+ kwalify (0.7.2)
96
+ launchy (3.0.1)
97
+ addressable (~> 2.8)
98
+ childprocess (~> 5.0)
99
+ logger (1.6.1)
100
+ loofah (2.22.0)
101
+ crass (~> 1.0.2)
102
+ nokogiri (>= 1.12.0)
35
103
  method_source (1.0.0)
104
+ minitest (5.15.0)
105
+ minitest-rails (6.1.1)
106
+ minitest (~> 5.10)
107
+ railties (~> 6.1.0)
36
108
  nio4r (2.5.8)
37
- parallel (1.20.1)
38
- parser (3.0.2.0)
109
+ nokogiri (1.12.5-x86_64-linux)
110
+ racc (~> 1.4)
111
+ parser (3.0.3.2)
39
112
  ast (~> 2.4.1)
113
+ path_expander (1.1.3)
40
114
  protocol-hpack (1.4.2)
41
- protocol-http (0.22.5)
115
+ protocol-http (0.22.6)
42
116
  protocol-http1 (0.14.2)
43
117
  protocol-http (~> 0.22)
44
118
  protocol-http2 (0.14.2)
@@ -50,47 +124,84 @@ GEM
50
124
  pry (0.14.1)
51
125
  coderay (~> 1.1)
52
126
  method_source (~> 1.0)
53
- rainbow (3.0.0)
127
+ public_suffix (4.0.7)
128
+ racc (1.8.1)
129
+ rack (2.2.9)
130
+ rack-test (2.1.0)
131
+ rack (>= 1.3)
132
+ rails-dom-testing (2.2.0)
133
+ activesupport (>= 5.0.0)
134
+ minitest
135
+ nokogiri (>= 1.6)
136
+ rails-html-sanitizer (1.5.0)
137
+ loofah (~> 2.19, >= 2.19.1)
138
+ railties (6.1.7.8)
139
+ actionpack (= 6.1.7.8)
140
+ activesupport (= 6.1.7.8)
141
+ method_source
142
+ rake (>= 12.2)
143
+ thor (~> 1.0)
144
+ rainbow (3.1.1)
54
145
  rake (13.0.6)
55
- regexp_parser (2.1.1)
56
- rexml (3.2.5)
57
- rspec (3.10.0)
58
- rspec-core (~> 3.10.0)
59
- rspec-expectations (~> 3.10.0)
60
- rspec-mocks (~> 3.10.0)
61
- rspec-core (3.10.1)
62
- rspec-support (~> 3.10.0)
63
- rspec-expectations (3.10.1)
146
+ reek (6.0.6)
147
+ kwalify (~> 0.7.0)
148
+ parser (~> 3.0.0)
149
+ rainbow (>= 2.0, < 4.0)
150
+ rspec (3.11.0)
151
+ rspec-core (~> 3.11.0)
152
+ rspec-expectations (~> 3.11.0)
153
+ rspec-mocks (~> 3.11.0)
154
+ rspec-core (3.11.0)
155
+ rspec-support (~> 3.11.0)
156
+ rspec-expectations (3.11.0)
64
157
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.10.0)
66
- rspec-mocks (3.10.2)
158
+ rspec-support (~> 3.11.0)
159
+ rspec-mocks (3.11.1)
67
160
  diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.10.0)
69
- rspec-support (3.10.2)
70
- rubocop (1.20.0)
71
- parallel (~> 1.10)
72
- parser (>= 3.0.0.0)
73
- rainbow (>= 2.2.2, < 4.0)
74
- regexp_parser (>= 1.8, < 3.0)
75
- rexml
76
- rubocop-ast (>= 1.9.1, < 2.0)
77
- ruby-progressbar (~> 1.7)
78
- unicode-display_width (>= 1.4.0, < 3.0)
79
- rubocop-ast (1.11.0)
80
- parser (>= 3.0.1.1)
81
- ruby-progressbar (1.11.0)
161
+ rspec-support (~> 3.11.0)
162
+ rspec-support (3.11.0)
163
+ ruby_parser (3.19.2)
164
+ sexp_processor (~> 4.16)
165
+ rubycritic (4.7.0)
166
+ flay (~> 2.8)
167
+ flog (~> 4.4)
168
+ launchy (>= 2.0.0)
169
+ parser (>= 2.6.0)
170
+ rainbow (~> 3.0)
171
+ reek (~> 6.0, < 7.0)
172
+ ruby_parser (~> 3.8)
173
+ simplecov (>= 0.17.0)
174
+ tty-which (~> 0.4.0)
175
+ virtus (~> 1.0)
176
+ sexp_processor (4.16.1)
177
+ simplecov (0.22.0)
178
+ docile (~> 1.1)
179
+ simplecov-html (~> 0.11)
180
+ simplecov_json_formatter (~> 0.1)
181
+ simplecov-html (0.13.1)
182
+ simplecov_json_formatter (0.1.4)
183
+ thor (1.2.2)
184
+ thread_safe (0.3.6)
82
185
  timers (4.3.3)
83
- unicode-display_width (2.0.0)
186
+ tty-which (0.4.2)
187
+ tzinfo (2.0.6)
188
+ concurrent-ruby (~> 1.0)
189
+ virtus (1.0.5)
190
+ axiom-types (~> 0.1)
191
+ coercible (~> 1.0)
192
+ descendants_tracker (~> 0.0, >= 0.0.3)
193
+ equalizer (~> 0.0, >= 0.0.9)
194
+ zeitwerk (2.6.18)
84
195
 
85
196
  PLATFORMS
86
- arm64-darwin-20
197
+ x86_64-linux
87
198
 
88
199
  DEPENDENCIES
200
+ async-websocket!
89
201
  fast_ci!
90
202
  pry
91
203
  rake (~> 13.0)
92
204
  rspec (~> 3.0)
93
- rubocop (~> 1.7)
94
205
 
95
206
  BUNDLED WITH
96
- 2.2.22
207
+ 2.2.26
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Ale
3
+ Copyright (c) 2022 Your Name
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -32,8 +32,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fast_ci.
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fast_ci. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/fast_ci/blob/master/CODE_OF_CONDUCT.md).
36
36
 
37
37
  ## License
38
38
 
39
39
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the FastCI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/fast_ci/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift "#{File.expand_path(File.dirname(__FILE__))}/../lib"
4
+
5
+ Encoding.default_external = 'UTF-8'
6
+
7
+ require 'fast_ci/brakeman'
8
+
9
+ FastCI::Brakeman.start
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Always look in the lib directory of this gem
5
+ # first when searching the load path
6
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
7
+
8
+ require 'bundler/audit/cli'
9
+ require 'fast_ci'
10
+ require 'base64'
11
+ require 'zlib'
12
+
13
+ $stdout = StringIO.new()
14
+ def $stdout.tty?
15
+ true
16
+ end
17
+
18
+ events = []
19
+
20
+ at_exit do
21
+ output = $stdout.string
22
+ $stdout = STDOUT
23
+
24
+ if $!.nil? || ($!.is_a?(SystemExit) && $!.success?)
25
+ code = 0
26
+ else
27
+ code = $!.is_a?(SystemExit) ? $!.status : 1
28
+ end
29
+
30
+ data = {
31
+ exitstatus: code,
32
+ output: "$ bundle-audit --update\n\n" + output,
33
+ key: 'bundler_audit',
34
+ index: 0,
35
+ title: 'Perform',
36
+ }
37
+ events << ['custom_exit_status'.upcase, ['0', data]]
38
+
39
+ if ENV['FSCI_REMOTE_TESTS'] == 'true'
40
+ json_events = {
41
+ build_id: FastCI.configuration.orig_build_id,
42
+ compressed_data: Base64.strict_encode64(Zlib::Deflate.deflate(JSON.fast_generate(events), 9)),
43
+ }
44
+
45
+ FastCI.send_events(json_events)
46
+ else
47
+ compressed_data = ::Base64.strict_encode64(Zlib::Deflate.deflate(output, 9))
48
+ FastCI.report_bundler_audit(compressed_data, (code == 0) ? 'passed' : 'failed')
49
+ end
50
+
51
+ output
52
+ end
53
+
54
+ events << ['custom_started'.upcase, ['0', { key: 'bundler_audit' }]]
55
+ Bundler::Audit::CLI.start
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Always look in the lib directory of this gem
5
+ # first when searching the load path
6
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
7
+
8
+ require 'fast_ci/ruby_critic/cli/application'
9
+
10
+ exit FastCI::RubyCritic::Cli::Application.new(ARGV + ["--format", "json"]).execute
data/fast_ci.gemspec CHANGED
@@ -5,8 +5,8 @@ require_relative "lib/fast_ci/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fast_ci"
7
7
  spec.version = FastCI::VERSION
8
- spec.authors = ["Ale "]
9
- spec.email = ["ale@alexvko.com"]
8
+ spec.authors = ["Nesha Zoric"]
9
+ spec.email = ["no-reply@ruby.ci"]
10
10
 
11
11
  spec.summary = "Ruby wrapper for creating FastCI integrations"
12
12
  spec.description = "Ruby wrapper for creating FastCI integrations"
@@ -23,10 +23,13 @@ Gem::Specification.new do |spec|
23
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
24
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
25
  end
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
26
+ spec.executables = ["fastci_rubycritic", "fastci_brakeman", "fastci_bundle_audit"]
28
27
  spec.require_paths = ["lib"]
29
28
 
30
- spec.add_dependency "async-websocket", "~> 0.19"
29
+ spec.add_dependency "console", "~> 1.10.0"
30
+ spec.add_dependency "async-websocket", '<= 0.20.0'
31
+ spec.add_dependency "rubycritic", ">= 4.1.0"
32
+ spec.add_dependency "brakeman", ">= 5.4.1"
33
+ spec.add_dependency "minitest-rails", ">= 5.1"
31
34
  spec.add_development_dependency "pry"
32
35
  end
@@ -0,0 +1,12 @@
1
+ require 'brakeman'
2
+ require 'brakeman/commandline'
3
+
4
+ module FastCI
5
+ module Brakeman
6
+ class Commandline < ::Brakeman::Commandline
7
+ def self.quit exit_code = 0, message = nil
8
+ warn message if message
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,30 @@
1
+ require 'fast_ci/brakeman/commandline'
2
+ require 'fast_ci'
3
+ require 'base64'
4
+ require 'zlib'
5
+
6
+ module FastCI
7
+ module Brakeman
8
+ def self.start
9
+ events = []
10
+ events << ['brakeman_run'.upcase, {}]
11
+ FastCI::Brakeman::Commandline.start(output_files: ['tmp/brakeman.json'], ensure_ignore_notes: false)
12
+
13
+ content = File.read('tmp/brakeman.json')
14
+ compressed_data = ::Base64.strict_encode64(Zlib::Deflate.deflate(content, 9))
15
+
16
+ events << ['brakeman_exit_status'.upcase, ['0', { exitstatus: 0, stderr: '', output: '', compressed_data: compressed_data }]]
17
+
18
+ if ENV['FSCI_REMOTE_TESTS'] == 'true'
19
+ json_events = {
20
+ build_id: FastCI.configuration.orig_build_id,
21
+ compressed_data: Base64.strict_encode64(Zlib::Deflate.deflate(JSON.fast_generate(events), 9)),
22
+ }
23
+
24
+ FastCI.send_events(json_events)
25
+ else
26
+ FastCI.report_brakeman(compressed_data, 'passed')
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,16 +2,22 @@
2
2
 
3
3
  module FastCI
4
4
  class Configuration
5
- attr_accessor :run_key, :build_id, :commit, :branch, :api_url, :secret_key
5
+ attr_accessor :run_key, :build_id, :commit_msg, :commit, :branch,
6
+ :api_url, :secret_key, :author, :fastci_main_url, :fastci_api_url, :orig_build_id
6
7
 
7
8
  def initialize
8
9
  # Settings defaults
9
10
  self.run_key = nil
10
11
  self.build_id = guess_build_id
11
12
  self.commit = guess_commit
13
+ self.commit_msg = `git log -1 --pretty=%B`.chomp
12
14
  self.branch = guess_branch
13
- self.api_url = ENV["FAST_CI_API_URL"] || "api.fast.ci"
15
+ self.api_url = ENV["FAST_CI_API_URL"] || "apx.fast.ci"
14
16
  self.secret_key = ENV.fetch("FAST_CI_SECRET_KEY")
17
+ self.author = guess_author
18
+ self.fastci_main_url = ENV.fetch('FASTCI_MAIN_URL', 'https://events.ruby.ci')
19
+ self.fastci_api_url = ENV.fetch('FASTCI_API_RB_URL', 'https://ruby.fast.ci')
20
+ self.orig_build_id = ENV['FSCI_ORIG_BUILD_ID']
15
21
  end
16
22
 
17
23
  def reset
@@ -22,22 +28,31 @@ module FastCI
22
28
  @run_key || raise("#run_key was not configured.")
23
29
  end
24
30
 
31
+ def guess_author
32
+ author_Line = `git show | grep Author:`
33
+ name, email = author_Line.scan(/Author: (.*) <(.*)>/).first
34
+ {
35
+ name: name,
36
+ email: email
37
+ }
38
+ end
39
+
25
40
  def guess_build_id
26
- %w[GITHUB_RUN_ID BUILD_ID CIRCLE_BUILD_NUM].find do |keyword|
41
+ %w[FSCI_BUILD_ID GITHUB_RUN_ID BUILD_ID CIRCLE_BUILD_NUM].find do |keyword|
27
42
  key = ENV.keys.find { |k| k[keyword] }
28
43
  break ENV[key] if key && ENV[key]
29
44
  end || guess_commit
30
45
  end
31
46
 
32
47
  def guess_commit
33
- %w[_COMMIT _SHA1 _SHA].find do |keyword|
48
+ %w[FSCI_COMMIT _COMMIT _SHA1 _SHA].find do |keyword|
34
49
  key = ENV.keys.find { |k| k[keyword] }
35
50
  break ENV[key] if key && ENV[key]
36
51
  end || `git rev-parse --short HEAD`.chomp
37
52
  end
38
53
 
39
54
  def guess_branch
40
- %w[_BRANCH _REF].find do |keyword|
55
+ %w[FSCI_BRANCH _BRANCH _REF].find do |keyword|
41
56
  key = ENV.keys.find { |k| k[keyword] }
42
57
  break ENV[key] if key && ENV[key]
43
58
  end || `git rev-parse --abbrev-ref HEAD`.chomp
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ require_relative "rspec_formatter"
3
+ require_relative "extract_definitions"
4
+
5
+ module FastCI
6
+ module DryrunRunnerPrepend
7
+ def run(err, out)
8
+ @rspec_started_at = Time.now
9
+ super
10
+ end
11
+
12
+ def exit_code(examples_passed=false)
13
+ run_time = Time.now - (@rspec_started_at || 1.seconds.ago)
14
+ events = @world.non_example_failure ? [['RSPEC_DRYRUN', { failed_after: run_time, test_env_number: ENV["TEST_ENV_NUMBER"], data: 'error' }]] : [['RSPEC_DRYRUN', { succeed_after: run_time, test_env_number: ENV["TEST_ENV_NUMBER"] }]]
15
+ STDOUT.puts events.inspect
16
+ json_events = {
17
+ build_id: FastCI.configuration.orig_build_id,
18
+ compressed_data: Base64.strict_encode64(Zlib::Deflate.deflate(JSON.fast_generate(events), 9)),
19
+ }
20
+ FastCI.send_events(json_events)
21
+
22
+ return @configuration.error_exit_code || @configuration.failure_exit_code if @world.non_example_failure
23
+ return @configuration.failure_exit_code unless examples_passed
24
+
25
+ 0
26
+ end
27
+ end
28
+ end