From f67511c6c1470fa6c1230306172814e9b6a67225 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Tue, 31 Oct 2023 14:06:10 -0700 Subject: [PATCH] Enforce coverage %. --- .github/workflows/build.yml | 24 ++++++++++++++++-------- .gitignore | 2 +- rollup.config.js | 5 ++++- vite.config.ts | 8 ++++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 344bdf89..4ed0f679 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: - dev pull_request: schedule: - - cron: "17 6 * * *" + - cron: '17 6 * * *' workflow_dispatch: jobs: @@ -25,23 +25,31 @@ jobs: - name: Install dependencies run: yarn install --immutable + - name: Test & Coverage + run: yarn run coverage + - name: Build run: yarn run build - - name: Test - run: yarn run test - - name: HACS build validation - uses: "hacs/action@21.12.1" + uses: 'hacs/action@21.12.1' with: - category: "plugin" + category: 'plugin' # Don't attempt to load into HACS (as it loads the release, not the # build). - ignore: "hacs" + ignore: 'hacs' - - name: Upload artifact + - name: Upload javascript uses: actions/upload-artifact@v3 with: name: frigate-hass-card path: dist/*.js + + # When this issue is fixed, it would be useful to upload visualizations: + # https://github.com/actions/upload-artifact/issues/14 + # - name: Upload visualizations + # uses: actions/upload-artifact@v3 + # with: + # name: frigate-hass-card + # path: visualizations/*.html diff --git a/.gitignore b/.gitignore index 13e1d646..6e919754 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ package-lock.json .env .envrc -stats.html +/visualizations/ /coverage/ # https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored diff --git a/rollup.config.js b/rollup.config.js index 821de314..9ebfe496 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -58,7 +58,10 @@ const plugins = [ }), watch && serve(serveopts), !dev && terser(), - visualizer(), + visualizer({ + filename: 'visualizations/treemap.html', + template: 'treemap', + }), ]; /** diff --git a/vite.config.ts b/vite.config.ts index c5d2f145..aeacea4f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,14 @@ export default defineConfig({ coverage: { // Favor istanbul for coverage over v8 due to better accuracy. provider: 'istanbul', + + // Thresholds will automatically be updated as coverage improves to avoid + // back-sliding. + thresholdAutoUpdate: true, + statements: 71.65, + branches: 60.62, + functions: 72.78, + lines: 71.54, }, }, });