From 3becf368fff6edc662228b7be978f17541076884 Mon Sep 17 00:00:00 2001 From: Travis Harris Date: Tue, 7 May 2024 01:15:39 -0700 Subject: [PATCH] test(designer): fix tests --- .github/workflows/base-coverage.yml | 15 +++++++++++++-- .github/workflows/coverage-report.yml | 15 +++++++++++++-- .gitignore | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/base-coverage.yml b/.github/workflows/base-coverage.yml index cd9137bb748..15a9c5ca2dc 100644 --- a/.github/workflows/base-coverage.yml +++ b/.github/workflows/base-coverage.yml @@ -23,6 +23,11 @@ jobs: with: node-version: 20.x + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.x + cache: true + - uses: pnpm/action-setup@v3 with: version: 8 @@ -31,8 +36,14 @@ jobs: args: [--frozen-lockfile, --strict-peer-dependencies] - run: pnpm turbo run test:lib --cache-dir=.turbo - - run: npx cobertura-merge-globby -o coverage.xml --files="**/cobertura-coverage.xml" + - name: Create code coverage report + run: | + dotnet tool install -g dotnet-reportgenerator-globaltool + reportgenerator -reports:"libs/*/coverage/cobertura-coverage.xml" -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub,Cobertura' + - uses: clearlyip/code-coverage-report-action@v4 with: #Location of the generated coverage file - filename: 'coverage.xml' \ No newline at end of file + filename: 'CodeCoverage/Cobertura.xml' + - name: Write to Job Summary + run: cat CodeCoverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index 8a6d3c29a05..6438f850cc8 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -24,6 +24,10 @@ jobs: key: ${{ runner.os }}-turbo-${{ github.sha }} restore-keys: | ${{ runner.os }}-turbo- + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.x + cache: true - name: Set up Node.js uses: actions/setup-node@v1 @@ -38,17 +42,24 @@ jobs: args: [--frozen-lockfile, --strict-peer-dependencies] - run: pnpm turbo run test:lib --cache-dir=.turbo -- --changed origin/main - - run: npx cobertura-merge-globby -o coverage.xml --files="**/cobertura-coverage.xml" + - name: Create code coverage report + run: | + dotnet tool install -g dotnet-reportgenerator-globaltool + reportgenerator -reports:"libs/*/coverage/cobertura-coverage.xml" -targetdir:CodeCoverage -reporttypes:'MarkdownSummaryGithub,Cobertura' + - name: Generate Coverage Report uses: clearlyip/code-coverage-report-action@v4 id: code_coverage_report_action with: #Location of the generate coverage file - filename: 'coverage.xml' + filename: 'CodeCoverage/Cobertura.xml' github_token: ${{ secrets.GITHUB_TOKEN }} badge: true fail_on_negative_difference: true artifact_download_workflow_names: 'base-coverage' + + - name: Write to Job Summary + run: cat CodeCoverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY - name: Add Coverage PR Comment #Make sure the report was generated and that the event is actually a pull request, run if failed or success uses: marocchino/sticky-pull-request-comment@v2 diff --git a/.gitignore b/.gitignore index 0df41404dfb..665dc7a6b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ build .nx # dependencies node_modules - +/CodeCoverage # IDEs and editors /.idea .project