Skip to content

Commit

Permalink
testing updating workflows and sync up with create-plugin (#104)
Browse files Browse the repository at this point in the history
* update to create-plugin 3.1.1

* add archive option to ci

* fix version check

* update
  • Loading branch information
briangann authored Jan 26, 2024
1 parent 2d5387a commit bb2262d
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .config/.cprc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2.6.0"
"version": "3.1.1"
}
27 changes: 15 additions & 12 deletions .config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const config = async (env): Promise<Configuration> => {
{ 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
Expand All @@ -178,18 +179,20 @@ const config = async (env): Promise<Configuration> => {
],
},
]),
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: {
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
94 changes: 42 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb2262d

Please sign in to comment.