From 47682e0605c214de144fe0731a776815dc9d710b Mon Sep 17 00:00:00 2001 From: Alberto Baroso Date: Sat, 25 May 2024 13:46:49 +0200 Subject: [PATCH 1/3] feat: upload coverage reports as GitHub Actions artifacts --- .github/workflows/fullstack.yml | 18 ++++++++++++++++++ sonar-project.properties | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fullstack.yml b/.github/workflows/fullstack.yml index 10319ec..76122b8 100644 --- a/.github/workflows/fullstack.yml +++ b/.github/workflows/fullstack.yml @@ -50,9 +50,21 @@ jobs: - name: Run shared unit tests run: pnpm --filter shared test:cov + - name: Upload shared unit test coverage report + uses: actions/upload-artifact@v4 + with: + name: shared-unit-coverage-report + path: ./shared/coverage/lcov.info + - name: Run api unit tests run: pnpm --filter api test:cov + - name: Upload api unit test coverage report + uses: actions/upload-artifact@v4 + with: + name: api-unit-coverage-report + path: ./coverage/api/lcov.info + - name: Run api e2e tests env: DATABASE_TYPE: sqlite @@ -64,6 +76,12 @@ jobs: AUTH0_CLIENT_SECRET: ${{ secrets.TEST_AUTH0_CLIENT_SECRET }} run: pnpm --filter api test-e2e:cov + - name: Upload api end-to-end test coverage report + uses: actions/upload-artifact@v4 + with: + name: api-e2e-coverage-report + path: ./coverage/api-e2e/lcov.info + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: diff --git a/sonar-project.properties b/sonar-project.properties index edb0d90..8e96e37 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,6 +2,6 @@ sonar.projectKey=MuNuChapterHKN_HKrecruitment sonar.organization=munuchapterhkn sonar.projectName=HKrecruitment -sonar.javascript.lcov.reportPaths=./coverage/shared/lcov.info, ./coverage/api/lcov.info, ./coverage/api-e2e/lcov.info +sonar.javascript.lcov.reportPaths=./shared-unit-coverage-report/lcov.info, ./api-unit-coverage-report/lcov.info, ./api-e2e-coverage-report/lcov.info sonar.sources=api/, frontend/, shared/ sonar.coverage.exclusions=**/node_modules/**/*, **/*.spec.*, **/*.e2e-spec.*, **/documentation/**/*, **/frontend/**/*, **/test/**/*, **/tests/**/*, **/*.json, **/*.yaml, **/*.yml, **/*.md From 567f80b6df81425510d53faa1772f58b02517b23 Mon Sep 17 00:00:00 2001 From: Alberto Baroso Date: Sat, 25 May 2024 15:06:24 +0200 Subject: [PATCH 2/3] fix: shared coverage path --- .github/workflows/fullstack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fullstack.yml b/.github/workflows/fullstack.yml index 76122b8..ff24b65 100644 --- a/.github/workflows/fullstack.yml +++ b/.github/workflows/fullstack.yml @@ -54,7 +54,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: shared-unit-coverage-report - path: ./shared/coverage/lcov.info + path: ./coverage/shared/lcov.info - name: Run api unit tests run: pnpm --filter api test:cov From 6d13db167a4d2bcc3e8fb75292795874ee3d9d4d Mon Sep 17 00:00:00 2001 From: Alberto Baroso Date: Sat, 25 May 2024 16:10:18 +0200 Subject: [PATCH 3/3] refactor: moved SonarCloud scan to separate job --- .github/workflows/fullstack.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fullstack.yml b/.github/workflows/fullstack.yml index ff24b65..2310b48 100644 --- a/.github/workflows/fullstack.yml +++ b/.github/workflows/fullstack.yml @@ -9,8 +9,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Install Node.js uses: actions/setup-node@v4 @@ -82,6 +80,19 @@ jobs: name: api-e2e-coverage-report path: ./coverage/api-e2e/lcov.info + sonarcloud: + name: SonarCloud Analysis + runs-on: ubuntu-latest + needs: tests + steps: + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: