Skip to content

Commit 2220018

Browse files
authored
github actions workflows added (#1107)
1 parent 2675268 commit 2220018

8 files changed

+186
-18
lines changed

.github/workflows/lint.yml

-15
This file was deleted.

.github/workflows/publish.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Plugins - CD
2+
run-name: Deploy ${{ inputs.branch }} to ${{ inputs.environment }} by @${{ github.actor }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: Branch to publish from. Can be used to deploy PRs to dev
9+
default: main
10+
environment:
11+
description: Environment to publish to
12+
required: true
13+
type: choice
14+
options:
15+
- 'dev'
16+
- 'ops'
17+
- 'prod'
18+
docs-only:
19+
description: Only publish docs, do not publish the plugin
20+
default: false
21+
type: boolean
22+
23+
jobs:
24+
cd:
25+
name: CD
26+
uses: grafana/plugin-ci-workflows/.github/workflows/cd.yml@main
27+
with:
28+
branch: ${{ github.event.inputs.branch }}
29+
environment: ${{ github.event.inputs.environment }}
30+
docs-only: ${{ fromJSON(github.event.inputs.docs-only) }}
31+
run-playwright: true

.github/workflows/push.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Plugins - CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
name: CI
14+
uses: grafana/plugin-ci-workflows/.github/workflows/ci.yml@main
15+
with:
16+
plugin-version-suffix: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
17+
run-playwright: true

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ docker/blocks/tempo/tempo-data
3232
# IDE
3333
.idea
3434
.eslintcache
35+
36+
# playwright
37+
test-results/
38+
playwright-report/
39+
blob-report/
40+
playwright/.cache/
41+
playwright/.auth/

docker-compose.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ services:
1717
- GF_DEFAULT_APP_MODE=development
1818
- GF_AUTH_ANONYMOUS_ENABLED=true
1919
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
20-
- GF_SECURITY_ADMIN_USER=infinity
21-
- GF_SECURITY_ADMIN_PASSWORD=infinity
2220
- GF_SECURITY_ANGULAR_SUPPORT_ENABLED=false
2321
- GF_SECURITY_CSRF_ALWAYS_CHECK=true
2422
- GF_ENTERPRISE_LICENSE_TEXT=$GF_ENTERPRISE_LICENSE_TEXT

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dev": "webpack -w -c ./webpack.config.ts --env development",
4141
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
4242
"lint:fix": "yarn run lint --fix",
43-
"server": "docker-compose up --build",
43+
"server": "docker compose up --build",
4444
"sign": "npx --yes @grafana/sign-plugin@latest",
4545
"spellcheck": "cspell -c cspell.config.json \"**/*.{ts,tsx,js,go,md,mdx,yml,yaml,json,scss,css}\"",
4646
"test": "jest --watch --onlyChanged",
@@ -78,7 +78,9 @@
7878
"@changesets/cli": "^2.26.1",
7979
"@changesets/types": "^5.2.1",
8080
"@grafana/eslint-config": "^7.0.0",
81+
"@grafana/plugin-e2e": "^1.14.6",
8182
"@grafana/tsconfig": "^1.2.0-rc1",
83+
"@playwright/test": "^1.48.0",
8284
"@swc/core": "^1.3.90",
8385
"@swc/helpers": "^0.5.0",
8486
"@swc/jest": "^0.2.26",

playwright.config.ts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type { PluginOptions } from '@grafana/plugin-e2e';
2+
import { defineConfig, devices } from '@playwright/test';
3+
import { dirname } from 'node:path';
4+
5+
const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
6+
7+
/**
8+
* Read environment variables from file.
9+
* https://github.com/motdotla/dotenv
10+
*/
11+
// require('dotenv').config();
12+
13+
/**
14+
* See https://playwright.dev/docs/test-configuration.
15+
*/
16+
export default defineConfig<PluginOptions>({
17+
testDir: './tests',
18+
/* Run tests in files in parallel */
19+
fullyParallel: true,
20+
/* Fail the build on CI if you accidentally left test.only in the source code. */
21+
forbidOnly: !!process.env.CI,
22+
/* Retry on CI only */
23+
retries: process.env.CI ? 2 : 0,
24+
/* Opt out of parallel tests on CI. */
25+
workers: process.env.CI ? 1 : undefined,
26+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
27+
reporter: 'html',
28+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
29+
use: {
30+
/* Base URL to use in actions like `await page.goto('/')`. */
31+
baseURL: 'http://localhost:3000',
32+
33+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
34+
trace: 'on-first-retry',
35+
},
36+
37+
/* Configure projects for major browsers */
38+
projects: [
39+
// 1. Login to Grafana and store the cookie on disk for use in other tests.
40+
{
41+
name: 'auth',
42+
testDir: pluginE2eAuth,
43+
testMatch: [/.*\.js/],
44+
},
45+
// 2. Run tests in Google Chrome. Every test will start authenticated as admin user.
46+
{
47+
name: 'chromium',
48+
use: { ...devices['Desktop Chrome'], storageState: 'playwright/.auth/admin.json' },
49+
dependencies: ['auth'],
50+
},
51+
],
52+
});

yarn.lock

+76
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,16 @@
10991099
tslib "2.6.0"
11001100
typescript "5.2.2"
11011101

1102+
"@grafana/e2e-selectors@^11.5.0-216287":
1103+
version "11.5.0-216566"
1104+
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d"
1105+
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA==
1106+
dependencies:
1107+
"@grafana/tsconfig" "^2.0.0"
1108+
semver "7.6.3"
1109+
tslib "2.8.1"
1110+
typescript "5.7.3"
1111+
11021112
"@grafana/eslint-config@^7.0.0":
11031113
version "7.0.0"
11041114
resolved "https://registry.yarnpkg.com/@grafana/eslint-config/-/eslint-config-7.0.0.tgz#9f8474a7d1c63e0510d7076ecbb644850693cb0b"
@@ -1130,6 +1140,16 @@
11301140
ua-parser-js "^1.0.32"
11311141
web-vitals "^3.1.1"
11321142

1143+
"@grafana/plugin-e2e@^1.14.6":
1144+
version "1.14.6"
1145+
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53"
1146+
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ==
1147+
dependencies:
1148+
"@grafana/e2e-selectors" "^11.5.0-216287"
1149+
semver "^7.5.4"
1150+
uuid "^11.0.2"
1151+
yaml "^2.3.4"
1152+
11331153
"@grafana/[email protected]":
11341154
version "10.3.3"
11351155
resolved "https://registry.yarnpkg.com/@grafana/runtime/-/runtime-10.3.3.tgz#273830689e4c8a73eb494771449716fcb36cf2ca"
@@ -1158,6 +1178,11 @@
11581178
resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-1.2.0-rc1.tgz#10973c978ec95b0ea637511254b5f478bce04de7"
11591179
integrity sha512-+SgQeBQ1pT6D/E3/dEdADqTrlgdIGuexUZ8EU+8KxQFKUeFeU7/3z/ayI2q/wpJ/Kr6WxBBNlrST6aOKia19Ag==
11601180

1181+
"@grafana/tsconfig@^2.0.0":
1182+
version "2.0.0"
1183+
resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-2.0.0.tgz#277aba907ddbe0301dc37248923e6bd2b68f5151"
1184+
integrity sha512-cxC3Htv/GidI5FeVGAzj/lYZTMMz/Cfsc8VOQFO3Ichjx3hUjyjeoBUIpVSVMnIjKUdA5ycdxtMYPHIuIrk8+A==
1185+
11611186
"@grafana/[email protected]":
11621187
version "10.3.3"
11631188
resolved "https://registry.yarnpkg.com/@grafana/ui/-/ui-10.3.3.tgz#27d5924f28ad81d5dc7080cd3f26ef551ceca66e"
@@ -1737,6 +1762,13 @@
17371762
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
17381763
integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==
17391764

1765+
"@playwright/test@^1.48.0":
1766+
version "1.49.1"
1767+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827"
1768+
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==
1769+
dependencies:
1770+
playwright "1.49.1"
1771+
17401772
"@popperjs/[email protected]":
17411773
version "2.11.8"
17421774
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f"
@@ -5428,6 +5460,11 @@ fs.realpath@^1.0.0:
54285460
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
54295461
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
54305462

5463+
5464+
version "2.3.2"
5465+
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
5466+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
5467+
54315468
fsevents@^2.3.2, fsevents@~2.3.2:
54325469
version "2.3.3"
54335470
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
@@ -7737,6 +7774,20 @@ pkg-dir@^4.2.0:
77377774
dependencies:
77387775
find-up "^4.0.0"
77397776

7777+
7778+
version "1.49.1"
7779+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
7780+
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==
7781+
7782+
7783+
version "1.49.1"
7784+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c"
7785+
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==
7786+
dependencies:
7787+
playwright-core "1.49.1"
7788+
optionalDependencies:
7789+
fsevents "2.3.2"
7790+
77407791
portfinder@^1.0.17:
77417792
version "1.0.32"
77427793
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81"
@@ -8780,6 +8831,11 @@ selection-is-backward@^1.0.0:
87808831
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"
87818832
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
87828833

8834+
8835+
version "7.6.3"
8836+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
8837+
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
8838+
87838839
semver@^6.0.0, semver@^6.3.0, semver@^6.3.1:
87848840
version "6.3.1"
87858841
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
@@ -9622,6 +9678,11 @@ [email protected]:
96229678
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3"
96239679
integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==
96249680

9681+
9682+
version "2.8.1"
9683+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
9684+
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
9685+
96259686
tslib@^1.8.1:
96269687
version "1.14.1"
96279688
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@@ -9755,6 +9816,11 @@ [email protected]:
97559816
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
97569817
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
97579818

9819+
9820+
version "5.7.3"
9821+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
9822+
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
9823+
97589824
ua-parser-js@^1.0.32:
97599825
version "1.0.38"
97609826
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.38.tgz#66bb0c4c0e322fe48edfe6d446df6042e62f25e2"
@@ -9860,6 +9926,11 @@ [email protected]:
98609926
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
98619927
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
98629928

9929+
uuid@^11.0.2:
9930+
version "11.0.5"
9931+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.5.tgz#07b46bdfa6310c92c3fb3953a8720f170427fc62"
9932+
integrity sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==
9933+
98639934
v8-compile-cache-lib@^3.0.1:
98649935
version "3.0.1"
98659936
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
@@ -10276,6 +10347,11 @@ yaml@^1.10.0:
1027610347
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
1027710348
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
1027810349

10350+
yaml@^2.3.4:
10351+
version "2.7.0"
10352+
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.7.0.tgz#aef9bb617a64c937a9a748803786ad8d3ffe1e98"
10353+
integrity sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==
10354+
1027910355
yargs-parser@^18.1.2, yargs-parser@^18.1.3:
1028010356
version "18.1.3"
1028110357
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"

0 commit comments

Comments
 (0)