Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit 69795d6

Browse files
committed
Add code coverage report
1 parent e203103 commit 69795d6

File tree

3 files changed

+68
-48
lines changed

3 files changed

+68
-48
lines changed

.github/workflows/npm-test.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: tests
3+
4+
on:
5+
pull_request:
6+
push:
7+
workflow_dispatch:
8+
inputs:
9+
concurrency:
10+
group: dashboard-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
tests:
15+
name: Run Tests
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: checkout
20+
uses: actions/checkout@v2
21+
22+
- uses: actions/setup-node@v2
23+
with:
24+
node-version: "12.22.0"
25+
cache: "npm"
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Run Tests
30+
if: github.event_name != 'pull_request'
31+
continue-on-error: true
32+
id: run-tests
33+
run: npm test -- --coverage --watchAll=false > /tmp/coverage_report
34+
35+
- name: Post Test Coverage Report in PR
36+
uses: ArtiomTr/jest-coverage-report-action@v2
37+
continue-on-error: true
38+
if: github.event_name == 'pull_request'
39+
with:
40+
test-script: npm run test
41+
annotations: all
42+
43+
- name: Gain access to test-reports bucket
44+
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
45+
uses: google-github-actions/setup-gcloud@master
46+
with:
47+
project_id: "netdata-cloud-testing"
48+
service_account_key: ${{ secrets.TEST_AUTOMATION_SERVICE_ACCOUNT }}
49+
export_default_credentials: true
50+
51+
- name: Upload report to test-reports bucket
52+
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
53+
run: |
54+
gsutil -h "Cache-Control: max-age=0, no-store" cp /tmp/coverage_report gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
55+
gsutil acl set project-private gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
56+
57+
- name: Publish test coverage report
58+
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
59+
uses: aurelien-baudet/workflow-dispatch@v2
60+
with:
61+
repo: netdata/cloud-workflows
62+
ref: refs/heads/main
63+
workflow: test_coverage_publisher.yml
64+
token: ${{ secrets.TEST_AUTOMATION_TOKEN }}
65+
inputs: '{ "service-name": "${{ github.event.repository.name }}"}'

tsconfig.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
"inlineSources": true,
1010
"sourceRoot": "/",
1111
"noImplicitAny": false,
12-
"lib": [
13-
"esnext",
14-
"dom",
15-
"dom.iterable"
16-
],
12+
"lib": ["esnext", "dom", "dom.iterable"],
1713
"module": "esnext",
1814
"target": "es2018",
1915
"jsx": "react",
@@ -28,12 +24,6 @@
2824
"noEmit": true,
2925
"declaration": true
3026
},
31-
"include": [
32-
"./src/**/*"
33-
],
34-
"exclude": [
35-
"/node_modules/",
36-
"**/*.test.ts",
37-
"**/*.test.tsx"
38-
]
27+
"include": ["./src/**/*", "src/vendor/dygraph-c91c859.min.js"],
28+
"exclude": ["/node_modules/", "**/*.test.ts", "**/*.test.tsx"]
3929
}

0 commit comments

Comments
 (0)