-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore/qa 1202 sonarqube integration #506
Merged
Merged
Changes from 23 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
7c312de
SonarQube initial setup
davidcauchi 4b7ddd7
Add on push to workflow
davidcauchi 508b53e
Adjust styling
davidcauchi 8c9ebcc
Adjust typo
davidcauchi 71126df
Remove args multiline
davidcauchi f498889
adjust sonar properties
davidcauchi 0612f2b
updated sonar workflow
davidcauchi 5f2b6a1
adjust for linting
davidcauchi ae9d438
adjust for linting
davidcauchi b41789f
remove unnecessary piped instruction
davidcauchi 66bb9d1
remove test.ts
davidcauchi ae0d8a4
rename golint step
davidcauchi e879e40
remove write to output
davidcauchi 893dd7b
add wildcard
davidcauchi 7c6b203
update find folder
davidcauchi b3b49ff
switch how we search for reports
davidcauchi 83c50cc
Rebase
smickovskid a8f50d7
Trying out sonar
smickovskid b66ba8a
Removed integration tests
smickovskid 86b32c7
Scan fix
smickovskid 3942483
Fixed naming
smickovskid f0734ea
Changed file names
smickovskid 6c82107
Added gauntlet to ignore for sonar
smickovskid 9e3da7f
Added lint tests
smickovskid 7720854
Fixing broken yml
smickovskid 9cccd89
fixed yml
smickovskid f686370
Rename
smickovskid ab746bd
Minor changes
smickovskid 1fa71cf
Added nix to run lint tests
smickovskid cf6aaad
Removed GOROOT which was not needed from shell.nix
smickovskid a7c2839
Fixing nix
smickovskid 28c2a00
Added timeout to golangci-lint
smickovskid 0667b8c
Adding || true to ci linters
smickovskid 2de81a3
Adding unused var for sonarcube confirmation
smickovskid 4562ffe
Removing unused var
smickovskid 0c60259
Added udev
smickovskid 8776314
Adjusted coverage
smickovskid 047672d
Chaning name to Golang Lint for required check
smickovskid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,94 @@ | ||
name: Unit testing and static analysis | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no unit testing steps in the workflow, please rename it by removing |
||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
wait_for_workflows: | ||
name: Wait for workflows | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | ||
|
||
- name: Wait for Workflows | ||
id: wait | ||
uses: smartcontractkit/chainlink-github-actions/utils/wait-for-workflows@main | ||
with: | ||
max-timeout: "1200" | ||
polling-interval: "30" | ||
exclude-workflow-names: "Lint GH Workflows,e2e_tests_custom_cl" | ||
exclude-workflow-ids: "" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
DEBUG: "true" | ||
tools: | ||
name: Get tool-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Code | ||
uses: actions/checkout@v3 | ||
- name: Parse tool-versions file | ||
uses: smartcontractkit/[email protected] | ||
id: tool-versions | ||
outputs: | ||
go-version: ${{ steps.tool-versions.outputs.golang_version }} | ||
golangci-lint-version: ${{ steps.tool-versions.outputs.golangci-lint_version }} | ||
|
||
sonarqube: | ||
name: SonarQube Scan | ||
needs: [wait_for_workflows] | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
steps: | ||
- name: Fetch blame information | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports | ||
|
||
- name: Download Golangci unit tests reports | ||
uses: dawidd6/[email protected] | ||
with: | ||
workflow: golangci-lint.yml | ||
workflow_conclusion: "" | ||
name_is_regexp: true | ||
name: golangci-lint-report | ||
if_no_artifact_found: warn | ||
|
||
- name: Download Golangci Relayer report | ||
uses: dawidd6/[email protected] | ||
with: | ||
workflow: relay.yml | ||
workflow_conclusion: "" | ||
name_is_regexp: true | ||
name: go-relay-test-results | ||
if_no_artifact_found: warn | ||
|
||
- name: Set SonarQube Report Paths | ||
id: sonarqube_report_paths | ||
shell: bash | ||
run: | | ||
{ | ||
echo "sonarqube_tests_report_paths=$(find . -type f -name output.txt | paste -sd "," -)" | ||
echo "sonarqube_coverage_report_paths=$(find . -type f -name '*coverage.txt' | paste -sd "," -)" | ||
echo "sonarqube_golangci_report_paths=$(find . -type f -name 'golangci-*-report.xml' -printf "%p,")" | ||
} >> "$GITHUB_OUTPUT" | ||
|
||
- name: SonarQube Scan | ||
uses: sonarsource/sonarqube-scan-action@a6ba0aafc293e03de5437af7edbc97f7d3ebc91a # v1.2.0 | ||
with: | ||
args: > | ||
-Dsonar.go.tests.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_tests_report_paths }} | ||
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }} | ||
-Dsonar.go.golangci-lint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_golangci_report_paths }} | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
|
||
|
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,13 @@ | ||
# required (may be found under "Project Information" in SonarQube) | ||
sonar.projectKey=smartcontractkit_chainlink-solana | ||
sonar.sources=. | ||
|
||
# Full exclusions from the static analysis | ||
krebernisak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sonar.exclusions=**/node_modules/**/*, **/contracts/artifacts/**/*, **/generated/**/*, **/docs/**/*, **/*.config.ts, **/*.config.js, **/*.txt | ||
# Coverage exclusions | ||
sonar.coverage.exclusions=**/*.test.ts, **/*_test.go, **/contracts/tests/**/*, **/integration-tests/**/* | ||
|
||
# Tests' root folder, inclusions (tests to check and count) and exclusions | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*_test.go, **/contracts/tests/**/* | ||
sonar.test.exclusions=**/integration-tests/*, **/gauntlet/* |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command won't produce a report, add
--out-format checkstyle:golangci-lint-report.xml
After done, verify in the corresponding workflow, that the artifact is uploading and in sonar-scan.yml, you get it (take a look here, the path for linter should not be empty)