Skip to content

Commit 7717632

Browse files
authored
Merge pull request #393 from splitio/master-into-dev-conflic
Master into dev conflict
2 parents e2083f5 + 4e3f73e commit 7717632

5 files changed

Lines changed: 82 additions & 59 deletions

File tree

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
services:
13+
redis:
14+
image: redis
15+
ports:
16+
- 6379:6379
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
25+
with:
26+
ruby-version: 2.5
27+
28+
- name: Install dependencies
29+
run: bundle install
30+
31+
- name: Run tests
32+
run: bundle exec rake
33+
34+
- name: Fix code coverage paths
35+
working-directory: ./coverage
36+
run: |
37+
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' .resultset.json
38+
ruby -rjson -e 'sqube = JSON.load(File.read(".resultset.json"))["RSpec"]["coverage"].transform_values {|lines| lines["lines"]}; total = { "RSpec" => { "coverage" => sqube, "timestamp" => Time.now.to_i }}; puts JSON.dump(total)' > .resultset.sonarqube.json
39+
40+
41+
- name: SonarQube Scan (Push)
42+
if: github.event_name == 'push'
43+
uses: SonarSource/sonarcloud-github-action@v1.5
44+
env:
45+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
46+
with:
47+
projectBaseDir: .
48+
args: >
49+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
50+
-Dsonar.projectName=${{ github.event.repository.name }}
51+
-Dsonar.projectKey=${{ github.event.repository.name }}
52+
-Dsonar.ruby.coverage.reportPaths=coverage/.resultset.sonarqube.json
53+
-Dsonar.c.file.suffixes=-
54+
-Dsonar.cpp.file.suffixes=-
55+
-Dsonar.objc.file.suffixes=-
56+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
57+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
58+
59+
- name: SonarQube Scan (Pull Request)
60+
if: github.event_name == 'pull_request'
61+
uses: SonarSource/sonarcloud-github-action@v1.5
62+
env:
63+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
64+
with:
65+
projectBaseDir: .
66+
args: >
67+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
68+
-Dsonar.projectName=${{ github.event.repository.name }}
69+
-Dsonar.projectKey=${{ github.event.repository.name }}
70+
-Dsonar.ruby.coverage.reportPaths=coverage/.resultset.sonarqube.json
71+
-Dsonar.c.file.suffixes=-
72+
-Dsonar.cpp.file.suffixes=-
73+
-Dsonar.objc.file.suffixes=-
74+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
75+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
76+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
77+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
78+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

sonar-scanner.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
require 'pry'
99

1010
require 'webmock/rspec'
11+
require 'simplecov-json'
12+
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
1113
WebMock.disable_net_connect!
1214

1315
ENV['SPLITCLIENT_ENV'] ||= 'test'

splitclient-rb.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Gem::Specification.new do |spec|
4545
spec.add_development_dependency 'rake-compiler'
4646
spec.add_development_dependency 'rspec'
4747
spec.add_development_dependency 'rubocop', '0.59.0'
48-
spec.add_development_dependency 'simplecov'
48+
spec.add_development_dependency 'simplecov', '0.20.0'
49+
spec.add_development_dependency 'simplecov-json'
4950
spec.add_development_dependency 'timecop'
5051
spec.add_development_dependency 'webmock'
5152

0 commit comments

Comments
 (0)