diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d08cdb3b3..3c61e7e064 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,8 +143,12 @@ jobs: name: Web UI workflow needs: get-vars permissions: - contents: read id-token: write # is required by nested component-check + # Required to checkout the code + contents: write + checks: write + # Required to put a comment into the pull-request + pull-requests: write secrets: AWS_ROLE: ${{ secrets.AWS_ROLE }} AWS_REGION: ${{ secrets.AWS_REGION }} diff --git a/.github/workflows/web-ui.yml b/.github/workflows/web-ui.yml index 2b5908255c..5dbb887d38 100644 --- a/.github/workflows/web-ui.yml +++ b/.github/workflows/web-ui.yml @@ -46,7 +46,7 @@ jobs: working-directory: "web_ui" run: tar -czf build.tar.gz build - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 with: name: webui-build path: "web_ui/build.tar.gz" @@ -95,8 +95,8 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2, 3, 4, 5] - shardTotal: [5] + shard: [1] + shardTotal: [1] steps: - name: Checkout code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2 @@ -114,7 +114,47 @@ jobs: - name: UI Unit tests working-directory: "web_ui" - run: npm run test:unit -- --silent --maxWorkers=2 --shard=${{ matrix.shard }}/${{ matrix.shardTotal }} + run: | + npm run test:unit -- --silent --maxWorkers=2 \ + --shard=${{ matrix.shard }}/${{ matrix.shardTotal }} \ + --coverage --json \ + --outputFile=coverage/coverage-shard-${{ matrix.shard }}.json \ + --testLocationInResults + + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 + with: + name: ui-unit-test-coverage-artifacts-${{ matrix.shard }} + path: web_ui/coverage/ + + report-unit-coverage: + runs-on: ubuntu-latest + permissions: + # Required to checkout the code + contents: write + checks: write + # Required to put a comment into the pull-request + pull-requests: write + needs: + - unit-tests + steps: + - uses: actions/checkout@v3 + + - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + pattern: ui-unit-test-coverage-artifacts-* + path: coverage/ + merge-multiple: true + + - name: Merge coverage reports + run: | + jq 'reduce inputs as $i (.; . * $i)' coverage/coverage-shard-*.json > coverage-merged.json + + - name: Publish test results + uses: ArtiomTr/jest-coverage-report-action@262a7bb0b20c4d1d6b6b026af0f008f78da72788 # v2.3.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + base-coverage-file: coverage-merged.json + coverage-file: coverage-merged.json playwright-tests: name: Playwright Tests (${{ matrix.shard }}/${{ matrix.shardTotal }}) @@ -159,7 +199,7 @@ jobs: run: npm run test:component -- --project "chromium" --project "chromium mini viewport" --shard=${{ matrix.shard }}/${{ matrix.shardTotal }} - name: Upload blob report to GitHub Actions Artifacts - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 if: always() with: name: playwright-blob-reports-${{ matrix.shard }} @@ -200,7 +240,7 @@ jobs: run: npx playwright merge-reports --reporter html ./playwright-blob-reports - name: Upload HTML report - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 with: name: playwright-html-report-attempt-${{ github.run_attempt }} path: web_ui/playwright-report diff --git a/web_ui/packages/config/test/jest.config.js b/web_ui/packages/config/test/jest.config.js index 8a406604b7..1b0afefe8e 100644 --- a/web_ui/packages/config/test/jest.config.js +++ b/web_ui/packages/config/test/jest.config.js @@ -21,5 +21,22 @@ export default { }, moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'], resetMocks: false, + coveragePathIgnorePatterns: [ + 'src/service-worker.ts', + 'src/serviceWorkerRegistration.ts', + 'src/webworkers', + 'src/hooks/use-worker/utils.ts', + 'src/theme', + 'src/report-web-vitals.ts', + 'src/app.component.tsx', + 'src/index.tsx', + 'src/assets', + 'src/e2e', + 'src/intel-admin-app', + 'src/sign-up', + 'dev-proxy.ts', + 'tests', + ], + coverageReporters: ['clover', 'json', 'json-summary'], globalSetup: path.resolve(dirname, './jest.global.js'), };