-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sonarcloud job and example (#35)
- Loading branch information
1 parent
80cc84e
commit 004d334
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
description: > | ||
Perform a sonarcloud scan including uploading test and coverage reports form a previous job | ||
usage: | ||
version: 2.1 | ||
orbs: | ||
toolbelt: ankorstore/[email protected] | ||
workflows: | ||
fail-fast-example: | ||
jobs: | ||
- test | ||
- toolbelt/sonarcloud: | ||
pipeline-id: << pipeline.id >> | ||
test-job: test | ||
branch: << pipeline.git.branch >><<pipeline.git.tag>> | ||
reports-pattern: path/to/reports/.* | ||
requires: | ||
- test | ||
jobs: | ||
test: | ||
docker: | ||
- image: cimg/base | ||
resource_class: small | ||
steps: | ||
- run: | ||
name: Run tests | ||
command: echo "Run some tests and produce test and coverage reports"; | ||
- store_artifacts: | ||
name: Store reports | ||
path: path/to/reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
description: > | ||
Perform a SonarCloud Scan | ||
First collects test results and test coverage from prior job artifacts. | ||
parameters: | ||
pipeline-id: | ||
type: string | ||
description: The CircleCI Pipeline ID ( << pipeline.id >> ) | ||
app-dir: | ||
default: /home/circleci/project | ||
description: >- | ||
Path to the directory containing your composer.json file. Not needed if | ||
composer.json lives in the working directory. | ||
type: string | ||
main-branch: | ||
type: string | ||
default: master | ||
description: The main branch of the repository | ||
branch: | ||
type: string | ||
description: >- | ||
The current branch name ( << pipeline.git.branch >> ). | ||
Required to ensure the baseline is updated correctly on the main-branch | ||
resource-class: | ||
default: medium | ||
description: Configure the executor resource class | ||
enum: | ||
- small | ||
- medium | ||
- medium+ | ||
- large | ||
- xlarge | ||
- 2xlarge | ||
- 2xlarge+ | ||
type: enum | ||
test-job: | ||
description: >- | ||
The test job or jobs from which to download test report and coverage artifacts. | ||
For multiple jobs the list must be comma separated. | ||
You can use regex if you start your name with ^. | ||
type: string | ||
reports-pattern: | ||
description: >- | ||
A regex pattern for the test report and coverage | ||
artifact path(s) to be downloaded | ||
type: string | ||
default: build/.* | ||
docker: | ||
- image: cimg/node:lts | ||
resource_class: << parameters.resource-class >> | ||
working_directory: << parameters.app-dir >> | ||
steps: | ||
- pass-fast: | ||
pipeline-id: << parameters.pipeline-id >> | ||
steps: | ||
- run: | ||
name: Clean Checkout directory | ||
command: rm -rf /home/circleci/project/* | ||
- checkout: | ||
path: /home/circleci/project | ||
- get-job-artifacts: | ||
job-name: << parameters.test-job >> | ||
path-pattern: << parameters.reports-pattern >> | ||
- sonar-scan: | ||
branch: << parameters.branch >> | ||
main-branch: << parameters.main-branch >> |