From bb2262d3c0884cc4d6febe7771785928514119ec Mon Sep 17 00:00:00 2001 From: Brian Gann Date: Thu, 25 Jan 2024 22:06:07 -0500 Subject: [PATCH] testing updating workflows and sync up with create-plugin (#104) * update to create-plugin 3.1.1 * add archive option to ci * fix version check * update --- .config/.cprc.json | 2 +- .config/webpack/webpack.config.ts | 27 +++++---- .github/workflows/ci.yml | 38 +++++++++++++ package.json | 13 +++-- pnpm-lock.yaml | 94 ++++++++++++++----------------- 5 files changed, 103 insertions(+), 71 deletions(-) diff --git a/.config/.cprc.json b/.config/.cprc.json index 93cec15..50ff2d2 100644 --- a/.config/.cprc.json +++ b/.config/.cprc.json @@ -1,3 +1,3 @@ { - "version": "2.6.0" + "version": "3.1.1" } diff --git a/.config/webpack/webpack.config.ts b/.config/webpack/webpack.config.ts index 24dfd32..2865de0 100644 --- a/.config/webpack/webpack.config.ts +++ b/.config/webpack/webpack.config.ts @@ -155,6 +155,7 @@ const config = async (env): Promise => { { from: 'img/**/*', to: '.', noErrorOnMissing: true }, // Optional { from: 'libs/**/*', to: '.', noErrorOnMissing: true }, // Optional { from: 'static/**/*', to: '.', noErrorOnMissing: true }, // Optional + { from: '**/query_help.md', to: '.', noErrorOnMissing: true }, // Optional ], }), // Replace certain template-variables in the README and plugin.json @@ -178,18 +179,20 @@ const config = async (env): Promise => { ], }, ]), - new ForkTsCheckerWebpackPlugin({ - async: Boolean(env.development), - issue: { - include: [{ file: '**/*.{ts,tsx}' }], - }, - typescript: { configFile: path.join(process.cwd(), 'tsconfig.json') }, - }), - new ESLintPlugin({ - extensions: ['.ts', '.tsx'], - lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files - }), - ...(env.development ? [new LiveReloadPlugin()] : []), + ...(env.development ? [ + new LiveReloadPlugin(), + new ForkTsCheckerWebpackPlugin({ + async: Boolean(env.development), + issue: { + include: [{ file: '**/*.{ts,tsx}' }], + }, + typescript: { configFile: path.join(process.cwd(), 'tsconfig.json') }, + }), + new ESLintPlugin({ + extensions: ['.ts', '.tsx'], + lintDirtyModulesOnly: Boolean(env.development), // don't lint on start, only lint changed files + }), + ] : []), ], resolve: { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc00d4f..09b2616 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }} steps: - uses: actions/checkout@v3 # pnpm action uses the packageManager field in package.json to @@ -91,6 +93,42 @@ jobs: path: cypress/videos retention-days: 5 + - name: Warn missing Grafana access policy token + run: | + echo Please generate a Grafana access policy token: https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token + echo Once done please follow the instructions found here: https://github.com/${{github.repository}}/blob/main/README.md#using-github-actions-release-workflow + if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN == '' }} + + - name: Sign plugin + run: pnpm run sign + if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }} + + - name: Get plugin metadata + id: metadata + run: | + sudo apt-get install jq + + export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id) + export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version) + export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip + + echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT + echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT + echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT + + - name: Package plugin + id: package-plugin + run: | + mv dist ${{ steps.metadata.outputs.plugin-id }} + zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r + + - name: Archive Build + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.metadata.outputs.plugin-id }}-${{ steps.metadata.outputs.plugin-version }} + path: ${{ steps.metadata.outputs.plugin-id }} + retention-days: 5 + - name: Code Climate - Check environment id: check-for-codeclimate env: diff --git a/package.json b/package.json index 15dfdbe..d456245 100644 --- a/package.json +++ b/package.json @@ -32,18 +32,18 @@ "@grafana/e2e": "10.1.5", "@grafana/e2e-selectors": "10.1.5", "@grafana/eslint-config": "^6.0.0", - "@grafana/tsconfig": "^1.3.0-rc1", + "@grafana/tsconfig": "^1.2.0-rc1", "@swc/core": "^1.3.90", "@swc/helpers": "^0.5.0", "@swc/jest": "^0.2.26", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^12.1.4", + "@testing-library/jest-dom": "6.1.4", + "@testing-library/react": "14.0.0", "@types/d3": "7.4.3", "@types/d3-scale": "4.0.8", "@types/glob": "^8.0.0", "@types/jest": "^29.5.0", - "@types/lodash": "^4.14.201", - "@types/node": "20.9.0", + "@types/lodash": "^4.14.194", + "@types/node": "^20.8.7", "copy-webpack-plugin": "^11.0.0", "cspell": "7.3.8", "css-loader": "^6.7.3", @@ -67,7 +67,8 @@ "webpack": "^5.86.0", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2", - "eslint-plugin-deprecation": "^2.0.0" + "eslint-plugin-deprecation": "^2.0.0", + "@types/testing-library__jest-dom": "5.14.8" }, "dependencies": { "@emotion/css": "^11.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 022bd22..358f55d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,8 +56,8 @@ devDependencies: specifier: ^6.0.0 version: 6.0.1 '@grafana/tsconfig': - specifier: ^1.3.0-rc1 - version: 1.3.0-rc1 + specifier: ^1.2.0-rc1 + version: 1.2.0-rc1 '@swc/core': specifier: ^1.3.90 version: 1.3.96(@swc/helpers@0.5.3) @@ -68,11 +68,11 @@ devDependencies: specifier: ^0.2.26 version: 0.2.29(@swc/core@1.3.96) '@testing-library/jest-dom': - specifier: ^5.16.5 - version: 5.17.0 + specifier: 6.1.4 + version: 6.1.4(@types/jest@29.5.8)(jest@29.7.0) '@testing-library/react': - specifier: ^12.1.4 - version: 12.1.5(react-dom@17.0.2)(react@17.0.2) + specifier: 14.0.0 + version: 14.0.0(react-dom@17.0.2)(react@17.0.2) '@types/d3': specifier: 7.4.3 version: 7.4.3 @@ -86,11 +86,14 @@ devDependencies: specifier: ^29.5.0 version: 29.5.8 '@types/lodash': - specifier: ^4.14.201 + specifier: ^4.14.194 version: 4.14.201 '@types/node': - specifier: 20.9.0 + specifier: ^20.8.7 version: 20.9.0 + '@types/testing-library__jest-dom': + specifier: 5.14.8 + version: 5.14.8 copy-webpack-plugin: specifier: ^11.0.0 version: 11.0.0(webpack@5.89.0) @@ -2143,10 +2146,6 @@ packages: /@grafana/tsconfig@1.2.0-rc1: resolution: {integrity: sha512-+SgQeBQ1pT6D/E3/dEdADqTrlgdIGuexUZ8EU+8KxQFKUeFeU7/3z/ayI2q/wpJ/Kr6WxBBNlrST6aOKia19Ag==} - /@grafana/tsconfig@1.3.0-rc1: - resolution: {integrity: sha512-bi+qFOptejg/a2/WmCDVxQLQtobhKd3y+B6mxFBOMmzElqgr30MPnN60THTou6dGwtfw+ExX1H5FGm9DM35Qrw==} - dev: true - /@grafana/ui@9.3.16(@babel/core@7.23.3)(react-dom@17.0.2)(react@17.0.2): resolution: {integrity: sha512-z0W7nyxmN5e2SgHOR21LrqQjBBDXBcbzrdFyZnljRvslK2x3YjU26cKWU05vyixj0Rno+N706WVtp5hRgitHxw==} peerDependencies: @@ -3299,20 +3298,6 @@ packages: resolution: {integrity: sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==} dev: true - /@testing-library/dom@8.20.1: - resolution: {integrity: sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==} - engines: {node: '>=12'} - dependencies: - '@babel/code-frame': 7.22.13 - '@babel/runtime': 7.23.2 - '@types/aria-query': 5.0.4 - aria-query: 5.1.3 - chalk: 4.1.2 - dom-accessibility-api: 0.5.16 - lz-string: 1.5.0 - pretty-format: 27.5.1 - dev: true - /@testing-library/dom@9.3.3: resolution: {integrity: sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==} engines: {node: '>=14'} @@ -3325,33 +3310,47 @@ packages: dom-accessibility-api: 0.5.16 lz-string: 1.5.0 pretty-format: 27.5.1 - dev: false - /@testing-library/jest-dom@5.17.0: - resolution: {integrity: sha512-ynmNeT7asXyH3aSVv4vvX4Rb+0qjOhdNHnO/3vuZNqPmhDpV/+rCSGwQ7bLcmU2cJ4dvoheIO85LQj0IbJHEtg==} - engines: {node: '>=8', npm: '>=6', yarn: '>=1'} + /@testing-library/jest-dom@6.1.4(@types/jest@29.5.8)(jest@29.7.0): + resolution: {integrity: sha512-wpoYrCYwSZ5/AxcrjLxJmCU6I5QAJXslEeSiMQqaWmP2Kzpd1LvF/qxmAIW2qposULGWq2gw30GgVNFLSc2Jnw==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + peerDependencies: + '@jest/globals': '>= 28' + '@types/jest': '>= 28' + jest: '>= 28' + vitest: '>= 0.32' + peerDependenciesMeta: + '@jest/globals': + optional: true + '@types/jest': + optional: true + jest: + optional: true + vitest: + optional: true dependencies: '@adobe/css-tools': 4.3.1 '@babel/runtime': 7.23.2 - '@types/testing-library__jest-dom': 5.14.9 + '@types/jest': 29.5.8 aria-query: 5.3.0 chalk: 3.0.0 css.escape: 1.5.1 dom-accessibility-api: 0.5.16 + jest: 29.7.0(@types/node@20.9.0)(ts-node@10.9.1) lodash: 4.17.21 redent: 3.0.0 dev: true - /@testing-library/react@12.1.5(react-dom@17.0.2)(react@17.0.2): - resolution: {integrity: sha512-OfTXCJUFgjd/digLUuPxa0+/3ZxsQmE7ub9kcbW/wi96Bh3o/p5vrETcBGfP17NWPGqeYYl5LTRpwyGoMC4ysg==} - engines: {node: '>=12'} + /@testing-library/react@14.0.0(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==} + engines: {node: '>=14'} peerDependencies: - react: <18.0.0 - react-dom: <18.0.0 + react: ^18.0.0 + react-dom: ^18.0.0 dependencies: '@babel/runtime': 7.23.2 - '@testing-library/dom': 8.20.1 - '@types/react-dom': 17.0.23 + '@testing-library/dom': 9.3.3 + '@types/react-dom': 18.2.18 react: 17.0.2 react-dom: 17.0.2(react@17.0.2) dev: true @@ -3703,10 +3702,10 @@ packages: /@types/prop-types@15.7.10: resolution: {integrity: sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==} - /@types/react-dom@17.0.23: - resolution: {integrity: sha512-lnJAZfMEDxfvELeeT24w4rnUYwpzUzQAOTfJQbWYnLcx8AEfz+fXJDCbowIBqNK/Bi4D6j8ovT8Qsda2OtDApA==} + /@types/react-dom@18.2.18: + resolution: {integrity: sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw==} dependencies: - '@types/react': 17.0.70 + '@types/react': 18.2.37 dev: true /@types/react-redux@7.1.30: @@ -3724,21 +3723,12 @@ packages: '@types/react': 18.2.37 dev: false - /@types/react@17.0.70: - resolution: {integrity: sha512-yqYMK49/cnqw+T8R9/C+RNjRddYmPDGI5lKHi3bOYceQCBAh8X2ngSbZP0gnVeyvHr0T7wEgIIGKT1usNol08w==} - dependencies: - '@types/prop-types': 15.7.10 - '@types/scheduler': 0.16.6 - csstype: 3.1.2 - dev: true - /@types/react@18.2.37: resolution: {integrity: sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==} dependencies: '@types/prop-types': 15.7.10 '@types/scheduler': 0.16.6 csstype: 3.1.2 - dev: false /@types/scheduler@0.16.6: resolution: {integrity: sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==} @@ -3759,8 +3749,8 @@ packages: resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} dev: true - /@types/testing-library__jest-dom@5.14.9: - resolution: {integrity: sha512-FSYhIjFlfOpGSRyVoMBMuS3ws5ehFQODymf3vlI7U1K8c7PHwWwFY7VREfmsuzHSOnoKs/9/Y983ayOs7eRzqw==} + /@types/testing-library__jest-dom@5.14.8: + resolution: {integrity: sha512-NRfJE9Cgpmu4fx716q9SYmU4jxxhYRU1BQo239Txt/9N3EC745XZX1Yl7h/SBIDlo1ANVOCRB4YDXjaQdoKCHQ==} dependencies: '@types/jest': 29.5.8 dev: true