From 67c75a8b9bf0bdbf0171be36adcebf81b3622662 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 09:29:50 -0700 Subject: [PATCH 01/18] #3813Sonarcloud onboarding Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 21 +++++++++++++++++++++ README.md | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dc84eb703..2a1e8912f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,27 @@ jobs: - run: ./canvas_modules/harness/build.sh test - run: ./canvas_modules/harness/functional_test.sh + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + node-version: 20.x + - name: Run tests + run: npm run --prefix canvas_modules/common-canvas test-coverage + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@2.3.0 + with: + args: > + -Dsonar.organization=my-organization + -Dsonar.projectKey=my-projectkey + -Dsonar.sources=canvas_modules/common-canvas/src + -Dsonar.tests=canvas_modules/common-canvas/__tests__ + -Dsonar.verbose=true + -Dsonar.javascript.lcov.reportPaths=canvas_modules/common-canvas/coverage/lcov.info + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + tag: runs-on: ubuntu-latest needs: [build] diff --git a/README.md b/README.md index c39cabc255..beecc21da9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,13 @@ See [here](https://github.com/elyra-ai/canvas/tree/main/canvas_modules/harness) * Elyra canvas documentation - https://elyra-ai.github.io/canvas/ * Elyra canvas playground (Test harness) - https://ibm.biz/elyra-canvas-test-harness +## Quality and Coverage +We use SonarCloud to ensure code quality and maintain high test coverage. You can view the detailed analysis and results by following the link below: + +[![SonarCloud](https://sonarcloud.io/api/project_badges/measure?project=your-project-key&metric=alert_status)](https://sonarcloud.io/dashboard?id=your-project-key) + +[View SonarCloud Results](https://sonarcloud.io/dashboard?id=your-project-key) + ## Using local version of common-canvas and/or common-properties Clone elyra/canvas ```sh From 03a202abca4db655100a62ce3ef035168a927136 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 09:46:12 -0700 Subject: [PATCH 02/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a1e8912f0..a9d60df4a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ jobs: - name: Run tests run: npm run --prefix canvas_modules/common-canvas test-coverage - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@2.3.0 + uses: sonarsource/sonarcloud-github-action@v1 with: args: > -Dsonar.organization=my-organization From f711afd3cc7ca1d0d8565cc8918763554eb590ed Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 10:09:34 -0700 Subject: [PATCH 03/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9d60df4a8..f8f908a4b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,6 +46,10 @@ jobs: - uses: actions/checkout@v4 with: node-version: 20.x + - name: Install project dependencies + run: npm install + - name: Install common-canvas dependencies + run: npm install --prefix canvas_modules/common-canvas - name: Run tests run: npm run --prefix canvas_modules/common-canvas test-coverage - name: SonarCloud Scan From ed5889439449f7a35fda182605b403a5b933b0ad Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 10:18:58 -0700 Subject: [PATCH 04/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8f908a4b2..64b5014cf9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,8 +46,6 @@ jobs: - uses: actions/checkout@v4 with: node-version: 20.x - - name: Install project dependencies - run: npm install - name: Install common-canvas dependencies run: npm install --prefix canvas_modules/common-canvas - name: Run tests From 35bf5e4c346238ef8f5e4e5c3502bab68fd111e2 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 11:04:17 -0700 Subject: [PATCH 05/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64b5014cf9..46458497c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,16 +52,6 @@ jobs: run: npm run --prefix canvas_modules/common-canvas test-coverage - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@v1 - with: - args: > - -Dsonar.organization=my-organization - -Dsonar.projectKey=my-projectkey - -Dsonar.sources=canvas_modules/common-canvas/src - -Dsonar.tests=canvas_modules/common-canvas/__tests__ - -Dsonar.verbose=true - -Dsonar.javascript.lcov.reportPaths=canvas_modules/common-canvas/coverage/lcov.info - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} tag: runs-on: ubuntu-latest From 3fd461ff5fc6620455f16b93d16664d842296a8a Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 11:15:15 -0700 Subject: [PATCH 06/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46458497c5..f7c88d351c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,8 +50,6 @@ jobs: run: npm install --prefix canvas_modules/common-canvas - name: Run tests run: npm run --prefix canvas_modules/common-canvas test-coverage - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@v1 tag: runs-on: ubuntu-latest From 037a5b2ec8679a9d4e3c854c222a1bc82ff0ca24 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 12:45:47 -0700 Subject: [PATCH 07/18] Added sonar properties file Signed-off-by: Prince Sanchez --- sonar-scanner.properties | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sonar-scanner.properties diff --git a/sonar-scanner.properties b/sonar-scanner.properties new file mode 100644 index 0000000000..76451833dc --- /dev/null +++ b/sonar-scanner.properties @@ -0,0 +1,7 @@ +sonar.projectKey=elyra-ai_canvas + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=canvas_modules/common-canvas/src +sonar.tests=canvas_modules/common-canvas/__tests__ +sonar.verbose=true \ No newline at end of file From 0984b44abc88815d6930c144248265ce488fa63b Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 13:22:26 -0700 Subject: [PATCH 08/18] Renamed sonar properties file Signed-off-by: Prince Sanchez --- sonar-scanner.properties => sonar-project.properties | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sonar-scanner.properties => sonar-project.properties (100%) diff --git a/sonar-scanner.properties b/sonar-project.properties similarity index 100% rename from sonar-scanner.properties rename to sonar-project.properties From fc03ba7657e34e039006d37fe0542f21caa5109d Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 1 Aug 2024 13:33:52 -0700 Subject: [PATCH 09/18] Added report path to sonar properties file Signed-off-by: Prince Sanchez --- sonar-project.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 76451833dc..955b00c7fa 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,4 +4,5 @@ sonar.projectKey=elyra-ai_canvas # in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ sonar.sources=canvas_modules/common-canvas/src sonar.tests=canvas_modules/common-canvas/__tests__ -sonar.verbose=true \ No newline at end of file +sonar.javascript.lcov.reportPaths=canvas_modules/common-canvas/coverage/lcov.info +sonar.verbose=true From 14955bf8854473e0dea83d1ae7c7370b256bbe59 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 07:35:36 -0700 Subject: [PATCH 10/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7c88d351c..74fedb8aee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,10 @@ jobs: run: npm install --prefix canvas_modules/common-canvas - name: Run tests run: npm run --prefix canvas_modules/common-canvas test-coverage + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + SONAR_TOKEN: ${{ secrets. SONARCLOUD_TOKEN }} tag: runs-on: ubuntu-latest From a30589a8286306c8d439baf437632693377da912 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 07:47:03 -0700 Subject: [PATCH 11/18] Token rename Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74fedb8aee..444b90ee05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: - SONAR_TOKEN: ${{ secrets. SONARCLOUD_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} tag: runs-on: ubuntu-latest From 991eb15481cd8a3d75bd2fc8f4c16ca21e05db34 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 08:17:02 -0700 Subject: [PATCH 12/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 444b90ee05..0b6f559592 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: - name: Run tests run: npm run --prefix canvas_modules/common-canvas test-coverage - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master + uses: SonarSource/sonarcloud-github-action@v1 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From d64b59a085bea1f71bf6306706b5d910f61b03ab Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 08:51:45 -0700 Subject: [PATCH 13/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b6f559592..7acdccc18e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,6 +54,7 @@ jobs: uses: SonarSource/sonarcloud-github-action@v1 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} tag: runs-on: ubuntu-latest From 74d1356fe2b2721bdb706dbf8d6263cf53a1ecc4 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 12:51:19 -0700 Subject: [PATCH 14/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7acdccc18e..98afec00eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,7 @@ jobs: - run: ./canvas_modules/harness/functional_test.sh sonarcloud: + if: github.repository == 'elyra-ai/canvas' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -54,7 +55,6 @@ jobs: uses: SonarSource/sonarcloud-github-action@v1 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GIT_TOKEN: ${{ secrets.GIT_TOKEN }} tag: runs-on: ubuntu-latest From b62f693e5577eacf9909627231692c25e31a7a86 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Fri, 2 Aug 2024 20:20:55 -0700 Subject: [PATCH 15/18] Minor change Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98afec00eb..e39ecff4ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,7 @@ jobs: uses: SonarSource/sonarcloud-github-action@v1 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} tag: runs-on: ubuntu-latest From 74e289350cd7f08765f1a7b6edc4a08be0f5ff70 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 8 Aug 2024 10:27:46 -0700 Subject: [PATCH 16/18] Updated sonarcloud to run against main Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 19 +++---------------- .github/workflows/sonarcloud.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e39ecff4ac..98b43fbd55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,23 +39,10 @@ jobs: - run: ./canvas_modules/common-canvas/build.sh - run: ./canvas_modules/harness/build.sh test - run: ./canvas_modules/harness/functional_test.sh - - sonarcloud: - if: github.repository == 'elyra-ai/canvas' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + - name: Upload coverage report + uses: actions/upload-artifact@v2 with: - node-version: 20.x - - name: Install common-canvas dependencies - run: npm install --prefix canvas_modules/common-canvas - - name: Run tests - run: npm run --prefix canvas_modules/common-canvas test-coverage - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@v1 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + path: ./canvas_modules/common-canvas/coverage/lcov.info tag: runs-on: ubuntu-latest diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000000..eb62ead754 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,27 @@ +name: Sonarcloud Analysis + +on: + push: + branches: + - main + +jobs: + sonarcloud: + if: github.repository == 'elyra-ai/canvas' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + node-version: 20.x + - name: Install common-canvas dependencies + run: npm install --prefix canvas_modules/common-canvas + - name: Download Coverage Report + uses: actions/download-artifact@v2 + with: + name: coverage-report + path: "./canvas_modules/common-canvas/coverage" + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@v1 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} From d09af30a9a56960014b6acdeca1203a75ca5c1b1 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 8 Aug 2024 12:39:00 -0700 Subject: [PATCH 17/18] Added conditional statement Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 18 +++++++++++++++--- .github/workflows/sonarcloud.yml | 27 --------------------------- 2 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98b43fbd55..b764d7dad7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,10 +39,22 @@ jobs: - run: ./canvas_modules/common-canvas/build.sh - run: ./canvas_modules/harness/build.sh test - run: ./canvas_modules/harness/functional_test.sh - - name: Upload coverage report - uses: actions/upload-artifact@v2 + + sonarcloud: + if: github.ref == 'refs/heads/main' + if: github.repository == 'elyra-ai/canvas' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 with: - path: ./canvas_modules/common-canvas/coverage/lcov.info + node-version: 20.x + - name: Install common-canvas dependencies + run: npm install --prefix canvas_modules/common-canvas + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@v1 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GIT_TOKEN: ${{ secrets.GIT_TOKEN }} tag: runs-on: ubuntu-latest diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index eb62ead754..0000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Sonarcloud Analysis - -on: - push: - branches: - - main - -jobs: - sonarcloud: - if: github.repository == 'elyra-ai/canvas' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - node-version: 20.x - - name: Install common-canvas dependencies - run: npm install --prefix canvas_modules/common-canvas - - name: Download Coverage Report - uses: actions/download-artifact@v2 - with: - name: coverage-report - path: "./canvas_modules/common-canvas/coverage" - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@v1 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - GIT_TOKEN: ${{ secrets.GIT_TOKEN }} From ae485435dab84e3a8c9f439b644f0887f3e28f98 Mon Sep 17 00:00:00 2001 From: Prince Sanchez Date: Thu, 8 Aug 2024 18:18:24 -0700 Subject: [PATCH 18/18] Updated README/Moved sonar job into build job Signed-off-by: Prince Sanchez --- .github/workflows/build.yml | 10 ---------- README.md | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b764d7dad7..b83063e741 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,17 +39,7 @@ jobs: - run: ./canvas_modules/common-canvas/build.sh - run: ./canvas_modules/harness/build.sh test - run: ./canvas_modules/harness/functional_test.sh - - sonarcloud: if: github.ref == 'refs/heads/main' - if: github.repository == 'elyra-ai/canvas' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - node-version: 20.x - - name: Install common-canvas dependencies - run: npm install --prefix canvas_modules/common-canvas - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v1 env: diff --git a/README.md b/README.md index beecc21da9..a6e8341c08 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ See [here](https://github.com/elyra-ai/canvas/tree/main/canvas_modules/harness) ## Quality and Coverage We use SonarCloud to ensure code quality and maintain high test coverage. You can view the detailed analysis and results by following the link below: -[![SonarCloud](https://sonarcloud.io/api/project_badges/measure?project=your-project-key&metric=alert_status)](https://sonarcloud.io/dashboard?id=your-project-key) +[![SonarCloud](https://sonarcloud.io/api/project_badges/measure?project=elyra-ai_canvas&metric=alert_status)](https://sonarcloud.io/dashboard?id=elyra-ai_canvas) -[View SonarCloud Results](https://sonarcloud.io/dashboard?id=your-project-key) +[View SonarCloud Results](https://sonarcloud.io/dashboard?id=elyra-ai_canvas) ## Using local version of common-canvas and/or common-properties Clone elyra/canvas