From 06b9f7940d486b41893b652b2bddaeaed1cd3cfc Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Thu, 30 Jan 2025 15:33:25 +0900 Subject: [PATCH] Add CI Resolves #1. Signed-off-by: Masashi Honma --- .github/workflows/ci.yaml | 37 ++++ pkg/supportability-review-app/.eslintrc.cjs | 19 ++ .../.prettierrc.json | 10 ++ .../components/ChecksSummaryWidget.vue | 12 +- .../components/ClusterDistroWidget.vue | 22 +-- .../components/DashboardView.vue | 4 +- .../components/InstallView.vue | 86 ++++----- .../components/ReportView.vue | 68 +++---- .../components/Summary.vue | 2 +- .../components/VectorsInfoWidgetDoughnut.vue | 48 ++--- pkg/supportability-review-app/config/types.js | 12 +- .../detail/sr.cattle.io.reviewbundle.vue | 2 +- .../edit/sr.cattle.io.reviewbundle.vue | 58 +++--- pkg/supportability-review-app/index.ts | 2 +- .../models/sr.cattle.io.reviewbundle.js | 50 +++--- pkg/supportability-review-app/package.json | 8 +- .../pages/DashboardPage.vue | 30 ++-- .../pages/ViewReportPage.vue | 4 +- pkg/supportability-review-app/product.js | 38 ++-- .../routing/sr-routing.js | 16 +- .../store/actions.ts | 4 +- .../store/getters.ts | 2 +- pkg/supportability-review-app/store/index.ts | 20 +-- .../store/mutations.ts | 4 +- pkg/supportability-review-app/tsconfig.json | 41 +---- .../utils/custom-routing.ts | 6 +- pkg/supportability-review-app/utils/utils.js | 26 +-- yarn.lock | 169 ++++++++++++++++-- 28 files changed, 491 insertions(+), 309 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 pkg/supportability-review-app/.eslintrc.cjs create mode 100644 pkg/supportability-review-app/.prettierrc.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f428655 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,37 @@ +name: CI Workflow + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + - dev + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Nodejs with yarn caching + uses: actions/setup-node@v4 + with: + cache: yarn + node-version-file: ".nvmrc" + + - name: Install dependencies + run: | + yarn install + + - name: Run lint + run: | + cd pkg/supportability-review-app/ + npm run format-check + + - name: Build Rancher Extension + run: | + yarn build-pkg supportability-review-app diff --git a/pkg/supportability-review-app/.eslintrc.cjs b/pkg/supportability-review-app/.eslintrc.cjs new file mode 100644 index 0000000..32c37c1 --- /dev/null +++ b/pkg/supportability-review-app/.eslintrc.cjs @@ -0,0 +1,19 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution'); + +module.exports = { + root: true, + extends: [ + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/eslint-config-typescript', + '@vue/eslint-config-prettier/skip-formatting' + ], + parserOptions: { + ecmaVersion: 'latest' + }, + rules: { + /* ignore _ variable name */ + '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_$' }] + } +}; diff --git a/pkg/supportability-review-app/.prettierrc.json b/pkg/supportability-review-app/.prettierrc.json new file mode 100644 index 0000000..0e01f05 --- /dev/null +++ b/pkg/supportability-review-app/.prettierrc.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": true, + "tabWidth": 2, + "singleQuote": true, + "printWidth": 120, + "trailingComma": "none", + "htmlWhitespaceSensitivity": "ignore", + "bracketSameLine": true +} diff --git a/pkg/supportability-review-app/components/ChecksSummaryWidget.vue b/pkg/supportability-review-app/components/ChecksSummaryWidget.vue index 56e8ed6..e1ee791 100644 --- a/pkg/supportability-review-app/components/ChecksSummaryWidget.vue +++ b/pkg/supportability-review-app/components/ChecksSummaryWidget.vue @@ -29,20 +29,20 @@ export default { }, computed: { summaryData() { - return [this.info.checks_pass, this.info.checks_warn, this.info.checks_fail, this.info.checks_skip] + return [this.info.checks_pass, this.info.checks_warn, this.info.checks_fail, this.info.checks_skip]; } }, methods: { getLabel(index) { - const labels = ['Pass', 'Warn', 'Fail', 'Skip'] - return labels[index] + const labels = ['Pass', 'Warn', 'Fail', 'Skip']; + return labels[index]; }, getBorderClass(index) { - const classes = ['border-success', 'border-warning', 'border-danger', 'border-secondary'] - return classes[index] + const classes = ['border-success', 'border-warning', 'border-danger', 'border-secondary']; + return classes[index]; } } -} +}; diff --git a/pkg/supportability-review-app/edit/sr.cattle.io.reviewbundle.vue b/pkg/supportability-review-app/edit/sr.cattle.io.reviewbundle.vue index 9c0320a..08673e3 100644 --- a/pkg/supportability-review-app/edit/sr.cattle.io.reviewbundle.vue +++ b/pkg/supportability-review-app/edit/sr.cattle.io.reviewbundle.vue @@ -1,9 +1,9 @@