From 2fcc5ee72e109fbf57f5a01d3e9563713ca3fb26 Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Thu, 1 Jun 2023 17:46:25 +0100 Subject: [PATCH] generate js coverage report in CI (#12029) relates to #8771 Add coverage for frontend and improve coverage reports around Backend and frontend code. --- .github/workflows/test-go.yaml | 1 + .github/workflows/test.yml | 15 +++++---------- .vscode/settings.json | 5 ++++- codecov.yml | 24 ++++++++++++++++++++++++ package.json | 1 + 5 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index c0bea47258..4ac2aaf4d3 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -103,6 +103,7 @@ jobs: uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 with: files: coverage.txt + flags: backend - name: Slack Notification if: github.event.schedule == '0 4 * * *' && failure() diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fa2183874..85c46e3a9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,20 +8,11 @@ on: pull_request: paths: - assets/** - - cypress/** - - ee/** - frontend/** - - pkg/** - - server/** - - tools/** - - go.mod - - go.sum - package.json - yarn.lock - - docker-compose.yml - webpack.config.js - tsconfig.json - - .github/workflows/test.yml # This allows a subsequently queued workflow run to interrupt previous runs concurrency: @@ -64,8 +55,12 @@ jobs: - name: Run JS Tests run: | - make test-js + yarn test:ci + - name: Upload to Codecov + uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 + with: + flags: frontend lint-js: strategy: diff --git a/.vscode/settings.json b/.vscode/settings.json index e82cd8b4c2..09e38123d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -35,5 +35,8 @@ "html.format.templating": true, "html.format.wrapAttributes": "preserve", "html.format.wrapLineLength": 0, - "prettier.requireConfig": true + "prettier.requireConfig": true, + "yaml.schemas": { + "https://json.schemastore.org/codecov.json": ".github/workflows/codecov.yml" + } } diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..d0a398457d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,24 @@ +coverage: + status: + project: false + patch: false + +flag_management: + default_rules: + carryforward: true + statuses: + - type: project + informational: true + - type: patch + informational: true + individual_flags: + - name: backend + paths: + - cmd/ + - pkg/ + - server/ + - ee/ + - orbit/ + - name: frontend + paths: + - frontend/ diff --git a/package.json b/package.json index 01786a4a92..e9ca1f75f4 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "lint": "eslint frontend cypress --ext .js,.jsx,.ts,.tsx", "prettier:check": "prettier --check frontend/**/*.{jsx,js,tsx,ts} ./cypress/**/*.{js,ts}", "test": "jest --config ./frontend/test/jest.config.ts", + "test:ci": "jest --config ./frontend/test/jest.config.ts --ci --coverage", "e2e-browser": "cypress open", "e2e-browser:free": "yarn cypress open --config-file cypress/cypress-free.json", "e2e-browser:premium": "yarn cypress open --config-file cypress/cypress-premium.json",