File tree 3 files changed +22
-3
lines changed
3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 21
21
steps :
22
22
- name : Checkout twilio-ruby
23
23
uses : actions/checkout@v2
24
+ with :
25
+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
24
26
25
27
- name : Set up Ruby
26
28
uses : ruby/setup-ruby@v1
43
45
- name : Run Unit Tests
44
46
run : make test
45
47
48
+ - name : Fix code coverage paths
49
+ if : ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.ruby == '3.0' && !github.event.pull_request.head.repo.fork }}
50
+ working-directory : ./coverage
51
+ run : |
52
+ sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.json
53
+
54
+ - name : SonarCloud Scan
55
+ if : ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.ruby == '3.0' && !github.event.pull_request.head.repo.fork }}
56
+ uses : SonarSource/sonarcloud-github-action@master
57
+ env :
58
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
59
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
60
+
46
61
deploy :
47
62
name : Deploy
48
63
if : success() && github.ref_type == 'tag'
Original file line number Diff line number Diff line change @@ -10,4 +10,4 @@ sonar.tests=spec/
10
10
sonar.test.exclusions =spec/integration/**/*.spec.rb
11
11
12
12
# For Code Coverage analysis
13
- sonar.ruby.coverage.reportPaths =coverage/.resultset.sonarqube .json
13
+ sonar.ruby.coverage.reportPaths =coverage/coverage .json
Original file line number Diff line number Diff line change 1
- require 'simplecov'
2
- SimpleCov . start
1
+ if RUBY_VERSION . start_with? ( '3.0' )
2
+ require 'simplecov'
3
+ require 'simplecov_json_formatter'
4
+ SimpleCov . formatter = SimpleCov ::Formatter ::JSONFormatter
5
+ SimpleCov . start
6
+ end
3
7
4
8
$LOAD_PATH. unshift ( File . join ( File . dirname ( __FILE__ ) , '..' , 'lib' ) )
5
9
You can’t perform that action at this time.
0 commit comments