[MM-62409] Generate and publish code coverage for webapp (#31144)

* Generate and publish code coverage for webapp

* Upate coverage output path

* Simplify coverage patterns

* Disable coverage file search

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Claudio Costa
2025-06-05 06:04:27 -06:00
коммит произвёл GitHub
родитель 50d81c2a38
Коммит 65c5f40c6a
5 изменённых файлов: 16 добавлений и 10 удалений

3
.github/codecov.yml поставляемый
Просмотреть файл

@@ -9,5 +9,8 @@ coverage:
project: project:
default: default:
threshold: 1.0 threshold: 1.0
codecov:
notify:
after_n_builds: 2 # Server and webapp at this point
ignore: ignore:
- ^store/storetest.* - ^store/storetest.*

1
.github/workflows/webapp-ci-pr.yml поставляемый
Просмотреть файл

@@ -18,3 +18,4 @@ concurrency:
jobs: jobs:
pr-ci: pr-ci:
uses: ./.github/workflows/webapp-ci-template.yml uses: ./.github/workflows/webapp-ci-template.yml
secrets: inherit

6
.github/workflows/webapp-ci-template.yml поставляемый
Просмотреть файл

@@ -75,6 +75,12 @@ jobs:
NODE_OPTIONS: --max_old_space_size=5120 NODE_OPTIONS: --max_old_space_size=5120
run: | run: |
npm run test-ci npm run test-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: ./webapp/channels/coverage/lcov.info
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

Просмотреть файл

@@ -8,15 +8,11 @@ const config = {
testPathIgnorePatterns: ['/node_modules/'], testPathIgnorePatterns: ['/node_modules/'],
clearMocks: true, clearMocks: true,
collectCoverageFrom: [ collectCoverageFrom: [
'actions/src/**/*.{js,jsx,ts,tsx}', 'src/**/*.{js,jsx,ts,tsx}',
'client/src/**/*.{js,jsx,ts,tsx}', ],
'components/src/**/*.{jsx,tsx}', coveragePathIgnorePatterns: [
'plugins/src/**/*.{js,jsx,ts,tsx}', '/node_modules/',
'reducers/src/**/*.{js,jsx,ts,tsx}', 'mattermost-redux/src/selectors/create_selector',
'routes/src/**/*.{js,jsx,ts,tsx}',
'selectors/src/**/*.{js,jsx,ts,tsx}',
'stores/src/**/*.{js,jsx,ts,tsx}',
'utils/src/**/*.{js,jsx,ts,tsx}',
], ],
coverageReporters: ['lcov', 'text-summary'], coverageReporters: ['lcov', 'text-summary'],
fakeTimers: { fakeTimers: {

Просмотреть файл

@@ -192,7 +192,7 @@
"test:watch": "cross-env TZ=Etc/UTC jest --watch", "test:watch": "cross-env TZ=Etc/UTC jest --watch",
"test:updatesnapshot": "cross-env TZ=Etc/UTC jest --updateSnapshot", "test:updatesnapshot": "cross-env TZ=Etc/UTC jest --updateSnapshot",
"test:debug": "cross-env TZ=Etc/UTC jest --forceExit --detectOpenHandles --verbose", "test:debug": "cross-env TZ=Etc/UTC jest --forceExit --detectOpenHandles --verbose",
"test-ci": "cross-env TZ=Etc/UTC jest --ci --maxWorkers=100%", "test-ci": "cross-env TZ=Etc/UTC jest --ci --maxWorkers=100% --coverage",
"clean": "rm -rf dist node_modules .eslintcache .stylelintcache tsconfig.tsbuildinfo", "clean": "rm -rf dist node_modules .eslintcache .stylelintcache tsconfig.tsbuildinfo",
"stats": "cross-env NODE_ENV=production webpack --profile --json > webpack_stats.json", "stats": "cross-env NODE_ENV=production webpack --profile --json > webpack_stats.json",
"mmjstool": "mmjstool", "mmjstool": "mmjstool",