Skip to content

Commit 0746b45

Browse files
committed
ci: add sonar scan
Signed-off-by: Arjun Rajappa <[email protected]>
1 parent 2c25208 commit 0746b45

File tree

1 file changed

+111
-101
lines changed

1 file changed

+111
-101
lines changed

.circleci/config.yml

Lines changed: 111 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ commands:
109109
run_sonarqube:
110110
steps:
111111
- run:
112-
name: Install Java for the SonarQube tool
112+
name: Install jq
113113
command: |
114-
sudo apt-get update
115-
sudo apt-get install openjdk-11-jdk
114+
apt-get update
115+
apt-get install jq -y
116116
- run:
117117
name: Install dependencies for coverage merge
118118
command: |
@@ -133,19 +133,29 @@ commands:
133133
BUNDLE_GEMFILE: './Gemfile'
134134
- run:
135135
name: Run SonarQube to report the coverage
136+
environment:
137+
SONAR_TOKEN: $SONAR_TOKEN
136138
command: |
137-
wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023.zip
138-
unzip -d /tmp /tmp/sonar-scanner-cli.zip
139+
export SONAR_SCANNER_VERSION=7.2.0.5079
140+
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
141+
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
142+
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
143+
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
144+
export SONAR_SCANNER_OPTS="-server"
139145
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
140-
/tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \
146+
sonar-scanner \
147+
-Dsonar.organization=instana \
148+
-Dsonar.projectKey=instana_ruby-sensor \
149+
-Dsonar.sources=. \
141150
-Dsonar.host.url="${SONARQUBE_URL}" \
142-
-Dsonar.login="${SONARQUBE_LOGIN}" \
143151
-Dsonar.pullrequest.key="${CIRCLE_PR_NUMBER}" \
144152
-Dsonar.pullrequest.branch="${CIRCLE_BRANCH}"
145153
else
146-
/tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \
154+
sonar-scanner \
155+
-Dsonar.organization=instana \
156+
-Dsonar.projectKey=instana_ruby-sensor \
157+
-Dsonar.sources=. \
147158
-Dsonar.host.url="${SONARQUBE_URL}" \
148-
-Dsonar.login="${SONARQUBE_LOGIN}" \
149159
-Dsonar.branch.name="${CIRCLE_BRANCH}"
150160
fi
151161
- store_artifacts:
@@ -233,7 +243,7 @@ jobs:
233243
executor: base
234244
steps:
235245
- checkout
236-
# - run_sonarqube
246+
- run_sonarqube
237247
publish:
238248
executor:
239249
name: "base"
@@ -266,96 +276,96 @@ workflows:
266276
- "3.3"
267277
- "3.4"
268278
- "3.5.0-preview1"
269-
libraries_ruby_31_32:
270-
jobs:
271-
- test_apprisal:
272-
name: "test_apprisal-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
273-
matrix:
274-
parameters:
275-
stack:
276-
- base
277-
<<: *library_gemfile
278-
ruby_version:
279-
- "3.1"
280-
- "3.2"
281-
libraries_ruby_33_35:
282-
jobs:
283-
- test_apprisal:
284-
name: "test_apprisal-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
285-
matrix:
286-
parameters:
287-
stack:
288-
- base
289-
<<: *library_gemfile
290-
ruby_version:
291-
- "3.3"
292-
- "3.4"
293-
- "3.5.0-preview1"
294-
# Currently compiling the native extensions for `grpc`
295-
# exceeds an internal RAM and/or CPU limit of CircleCI executor,
296-
# and the job gets terminated with:
297-
# `Received "killed" signal`
298-
# Hence we exclude it here for the time being.
299-
# TODO: Remove this exclusion as soon as pre-built binaries are available
300-
# on https://rubygems.org/gems/grpc/versions
301-
exclude:
302-
- stack: base
303-
ruby_version: "3.5.0-preview1"
304-
gemfile: "./gemfiles/grpc_10.gemfile"
305-
rails_ruby_31_35:
306-
jobs:
307-
- test_apprisal:
308-
name: "test_apprisal-rails-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
309-
matrix:
310-
parameters:
311-
stack:
312-
- base
313-
- mysql2
314-
- postgres
315-
gemfile:
316-
- "./gemfiles/rails_61.gemfile"
317-
- "./gemfiles/rails_70.gemfile"
318-
- "./gemfiles/rails_71.gemfile"
319-
ruby_version:
320-
- "3.1"
321-
- "3.2"
322-
- "3.3"
323-
- "3.4"
324-
- "3.5.0-preview1"
325-
rails8_ruby_33_35:
326-
jobs:
327-
- test_apprisal:
328-
name: "test_apprisal-rails-8-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
329-
matrix:
330-
parameters:
331-
stack:
332-
- base
333-
- mysql2
334-
- postgres
335-
gemfile:
336-
- "./gemfiles/rails_80.gemfile"
337-
ruby_version:
338-
- "3.2"
339-
- "3.3"
340-
- "3.4"
341-
sequel:
342-
jobs:
343-
- test_apprisal:
344-
name: "test_apprisal-sequel-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
345-
matrix:
346-
parameters:
347-
stack:
348-
- base
349-
- mysql2
350-
gemfile:
351-
- "./gemfiles/sequel_56.gemfile"
352-
- "./gemfiles/sequel_57.gemfile"
353-
- "./gemfiles/sequel_58.gemfile"
354-
ruby_version:
355-
- "3.1"
356-
- "3.2"
357-
- "3.3"
358-
- "3.5.0-preview1"
279+
# libraries_ruby_31_32:
280+
# jobs:
281+
# - test_apprisal:
282+
# name: "test_apprisal-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
283+
# matrix:
284+
# parameters:
285+
# stack:
286+
# - base
287+
# <<: *library_gemfile
288+
# ruby_version:
289+
# - "3.1"
290+
# - "3.2"
291+
# libraries_ruby_33_35:
292+
# jobs:
293+
# - test_apprisal:
294+
# name: "test_apprisal-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
295+
# matrix:
296+
# parameters:
297+
# stack:
298+
# - base
299+
# <<: *library_gemfile
300+
# ruby_version:
301+
# - "3.3"
302+
# - "3.4"
303+
# - "3.5.0-preview1"
304+
# # Currently compiling the native extensions for `grpc`
305+
# # exceeds an internal RAM and/or CPU limit of CircleCI executor,
306+
# # and the job gets terminated with:
307+
# # `Received "killed" signal`
308+
# # Hence we exclude it here for the time being.
309+
# # TODO: Remove this exclusion as soon as pre-built binaries are available
310+
# # on https://rubygems.org/gems/grpc/versions
311+
# exclude:
312+
# - stack: base
313+
# ruby_version: "3.5.0-preview1"
314+
# gemfile: "./gemfiles/grpc_10.gemfile"
315+
# rails_ruby_31_35:
316+
# jobs:
317+
# - test_apprisal:
318+
# name: "test_apprisal-rails-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
319+
# matrix:
320+
# parameters:
321+
# stack:
322+
# - base
323+
# - mysql2
324+
# - postgres
325+
# gemfile:
326+
# - "./gemfiles/rails_61.gemfile"
327+
# - "./gemfiles/rails_70.gemfile"
328+
# - "./gemfiles/rails_71.gemfile"
329+
# ruby_version:
330+
# - "3.1"
331+
# - "3.2"
332+
# - "3.3"
333+
# - "3.4"
334+
# - "3.5.0-preview1"
335+
# rails8_ruby_33_35:
336+
# jobs:
337+
# - test_apprisal:
338+
# name: "test_apprisal-rails-8-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
339+
# matrix:
340+
# parameters:
341+
# stack:
342+
# - base
343+
# - mysql2
344+
# - postgres
345+
# gemfile:
346+
# - "./gemfiles/rails_80.gemfile"
347+
# ruby_version:
348+
# - "3.2"
349+
# - "3.3"
350+
# - "3.4"
351+
# sequel:
352+
# jobs:
353+
# - test_apprisal:
354+
# name: "test_apprisal-sequel-<<matrix.gemfile>>-ruby-<<matrix.stack>>-<<matrix.ruby_version>>"
355+
# matrix:
356+
# parameters:
357+
# stack:
358+
# - base
359+
# - mysql2
360+
# gemfile:
361+
# - "./gemfiles/sequel_56.gemfile"
362+
# - "./gemfiles/sequel_57.gemfile"
363+
# - "./gemfiles/sequel_58.gemfile"
364+
# ruby_version:
365+
# - "3.1"
366+
# - "3.2"
367+
# - "3.3"
368+
# - "3.5.0-preview1"
359369
report_coverage:
360370
jobs:
361-
- report_coverage
371+
- report_coverage

0 commit comments

Comments
 (0)