-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: SonarQube Scan | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
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 | ||
uses: smartcontractkit/chainlink-github-actions/utils/wait-for-workflows@main | ||
with: | ||
max-timeout: "900" | ||
polling-interval: "30" | ||
exclude-workflow-names: "Integration Tests, Package Artifact Tests" | ||
exclude-workflow-ids: "" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
DEBUG: "true" | ||
|
||
sonarqube: | ||
name: SonarQube Scan | ||
needs: [wait_for_workflows] | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports | ||
|
||
- name: Download unit-tests report | ||
uses: dawidd6/[email protected] | ||
with: | ||
workflow: unit-test.yaml | ||
workflow_conclusion: "" | ||
name: unit-tests-coverage | ||
if_no_artifact_found: warn | ||
|
||
- name: Set SonarQube Report Paths | ||
if: always() | ||
id: sonarqube_report_paths | ||
shell: bash | ||
run: | | ||
echo "sonarqube_coverage_report_paths=$(find -type f -name 'lcov.info' -printf "%p,")" >> $GITHUB_OUTPUT | ||
echo "sonarqube_eslint_report_paths=$(find -type f -name 'eslint-report.json' -printf "%p")" >> $GITHUB_OUTPUT | ||
# TODO: uncomment when ESLint report is available | ||
# - name: Update ESLint report symlinks | ||
# continue-on-error: true | ||
# run: sed -i 's+/home/runner/work/universal-adapter-sandbox/universal-adapter-sandbox/+/github/workspace/+g' ${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }} | ||
|
||
- name: SonarQube Scan | ||
if: always() | ||
uses: sonarsource/[email protected] | ||
with: | ||
args: > | ||
-Dsonar.javascript.lcov.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }} | ||
-Dsonar.eslint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }} | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
name: Jest Tests | ||
name: Unit Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tests: | ||
|
@@ -11,10 +14,10 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
|
@@ -26,5 +29,12 @@ jobs: | |
with: | ||
deno-version: '1.36.2' | ||
|
||
- name: Run Jest tests | ||
run: npm test | ||
- name: Run unit tests | ||
run: npm run test | ||
|
||
- name: Upload unit-test coverage report | ||
if: always() | ||
uses: actions/[email protected] | ||
with: | ||
name: unit-tests-coverage | ||
path: ./coverage/lcov.info |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist | ||
node_modules | ||
*report.json |
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,11 @@ | ||
sonar.projectKey=smartcontractkit_functions-toolkit | ||
sonar.sources=. | ||
|
||
# Full exclusions from the static analysis | ||
sonar.exclusions=**/node_modules/**/*, **/mocks/**/*, **/testdata/**/*, **/demo/**/*, **/contracts/**/*, **/generated/**/*, **/fixtures/**/*, **/docs/**/*, **/tools/**/*, **/*.fixtures.ts, **/apiFixture.ts, **/*report.xml, **/*.config.ts, **/*.txt, **/*.abi, **/*.bin | ||
# Coverage exclusions | ||
sonar.coverage.exclusions=**/*.test.ts, **/test/**/*, **/contracts/**/*, **/testutils/**/*, **/test/integration/**/*, **/offchain_storage/**/*, **/simulateScript/**/*, **/v1_contract_sources/**/*, **/*.config.js, **/*.config.ts, | ||
|
||
# Tests' root folder, inclusions (tests to check and count) and exclusions | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*.test.ts |