From 1a95f5598319565ca2dd3c2ac1b498c5c1975154 Mon Sep 17 00:00:00 2001 From: Sebastiano Schwarz Date: Mon, 4 Mar 2024 14:33:36 +0100 Subject: [PATCH] chore(ci): add validation deployment and apex test execution (#85) * chore(ci): install salesforce cli and perform org login * chore(ci): deploy metadata to authenticated org * chore(ci): run apex unit tests * chore(ci): include apex test coverage results in sonar scan --- .github/workflows/ci.yml | 10 ++++++++++ sonar-project.properties | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7125da3..842e633 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,16 @@ jobs: run: npm run lint:sonar - name: LWC Unit Tests run: npm run test:unit:coverage + - name: Install SF CLI + run: | + npm i -g @salesforce/cli + sf version + - name: Salesforce Org Login + run: sf org login sfdx-url --set-default --sfdx-url-file <(echo "${{ secrets.SFDX_AUTH_URL }}") + - name: Deploy Metadata + run: sf project deploy start + - name: Apex Unit Tests + run: sf apex run test --test-level=RunLocalTests --code-coverage --result-format=human -w 30 -d ./tests/apex --detailed-coverage - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: diff --git a/sonar-project.properties b/sonar-project.properties index b674b60..1ee528a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -15,4 +15,5 @@ sonar.exclusions=docs/** sonar.test.inclusions=**/*test.js sonar.coverage.exclusions=**/aura/**/*.js,jest-sa11y-setup.js,jest.config.js,**/test/**/*.js,**/*.cls,**/docs/**/*.js sonar.javascript.lcov.reportPaths=./coverage/lcov.info -sonar.eslint.reportPaths=./eslint-report.json \ No newline at end of file +sonar.eslint.reportPaths=./eslint-report.json +sonar.apex.coverage.reportPath=./tests/apex/test-result-codecoverage.json \ No newline at end of file