Skip to content

Commit 65165e4

Browse files
github actions workflows added (#312)
* github actions workflows added * added playwright tests * Update .github/workflows/push.yaml Co-authored-by: Sriram <153843+yesoreyeram@users.noreply.github.com> * Update .github/workflows/push.yaml * Update .github/workflows/publish.yaml --------- Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
1 parent 196e512 commit 65165e4

File tree

7 files changed

+182
-111
lines changed

7 files changed

+182
-111
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/publish.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
go-version: '1.23.5'
29+
branch: ${{ github.event.inputs.branch }}
30+
environment: ${{ github.event.inputs.environment }}
31+
docs-only: ${{ fromJSON(github.event.inputs.docs-only) }}
32+
run-playwright: true

.github/workflows/push.yaml

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

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,11 @@ todo.txt
148148

149149
# dist directory
150150
dist/
151-
provisioning/
151+
provisioning/
152+
153+
# playwright
154+
test-results/
155+
playwright-report/
156+
blob-report/
157+
playwright/.cache/
158+
playwright/.auth/

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
99
"build:sign": "yarn run build && yarn run sign",
1010
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
11-
"e2e": "yarn exec cypress install && yarn exec grafana-e2e run",
12-
"e2e:update": "yarn exec cypress install && yarn exec grafana-e2e run --update-screenshots",
11+
"e2e": "yarn playwright test",
1312
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
1413
"lint:fix": "yarn run lint --fix && prettier --write --list-different .",
1514
"lint:ts": "eslint . --ext .js,.tsx,.ts --cache",
@@ -46,7 +45,9 @@
4645
"devDependencies": {
4746
"@babel/core": "^7.21.4",
4847
"@grafana/eslint-config": "^8.0.0",
48+
"@grafana/plugin-e2e": "^1.14.6",
4949
"@grafana/tsconfig": "^2.0.0",
50+
"@playwright/test": "^1.48.0",
5051
"@stylistic/eslint-plugin-ts": "^2.9.0",
5152
"@swc/core": "^1.3.90",
5253
"@swc/helpers": "^0.5.0",

playwright.config.ts

Lines changed: 52 additions & 0 deletions
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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,16 @@
10051005
tslib "2.6.2"
10061006
typescript "5.3.3"
10071007

1008+
"@grafana/e2e-selectors@^11.5.0-216287":
1009+
version "11.5.0-216566"
1010+
resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.5.0-216566.tgz#bec2387690e2a9046dcd97e29102fc22f72af11d"
1011+
integrity sha512-uhMZxhVOsMjLIRNI7yJRXcfm+F1LXLITdCCkKNh5ATMLe67utpTKWK89Yi9534R0SN38i8w8ReChehetbR0gFA==
1012+
dependencies:
1013+
"@grafana/tsconfig" "^2.0.0"
1014+
semver "7.6.3"
1015+
tslib "2.8.1"
1016+
typescript "5.7.3"
1017+
10081018
"@grafana/eslint-config@^8.0.0":
10091019
version "8.0.0"
10101020
resolved "https://registry.yarnpkg.com/@grafana/eslint-config/-/eslint-config-8.0.0.tgz#207049e69bb9fe7c007d207cd79fcfe28a781288"
@@ -1032,6 +1042,16 @@
10321042
resolved "https://registry.yarnpkg.com/@grafana/google-sdk/-/google-sdk-0.1.2.tgz#711436b4a32e6060eed2faa8882b118129e492f0"
10331043
integrity sha512-E4q2bhdP3s+ezMamu5d+4kzGktMNax5K3CDsUB4vpb7vkYTbnJhyxzTOY/2Vt4/TMN9MV1AN3zuLzcx9+yXtMQ==
10341044

1045+
"@grafana/plugin-e2e@^1.14.6":
1046+
version "1.14.6"
1047+
resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.14.6.tgz#3ad08b4fd5aadee8dfd9170c7bb6d5e31a67bb53"
1048+
integrity sha512-YnARXviUFI+Ez0ygi1CypBHZGY+rNIShI428Mnrj8bn48mr0lCeiI/V2NGsQUz5YJegIfP1JSb05gb/7t8avBQ==
1049+
dependencies:
1050+
"@grafana/e2e-selectors" "^11.5.0-216287"
1051+
semver "^7.5.4"
1052+
uuid "^11.0.2"
1053+
yaml "^2.3.4"
1054+
10351055
"@grafana/plugin-ui@^0.9.2":
10361056
version "0.9.2"
10371057
resolved "https://registry.yarnpkg.com/@grafana/plugin-ui/-/plugin-ui-0.9.2.tgz#af32ea54e2f349ed7ad36823b21a1c3ae8acbc5f"
@@ -1659,6 +1679,13 @@
16591679
picocolors "^1.0.0"
16601680
tslib "^2.6.0"
16611681

1682+
"@playwright/test@^1.48.0":
1683+
version "1.49.1"
1684+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827"
1685+
integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g==
1686+
dependencies:
1687+
playwright "1.49.1"
1688+
16621689
"@popperjs/core@2.11.8", "@popperjs/core@^2.11.5":
16631690
version "2.11.8"
16641691
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f"
@@ -5016,6 +5043,11 @@ fs.realpath@^1.0.0:
50165043
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
50175044
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
50185045

5046+
fsevents@2.3.2:
5047+
version "2.3.2"
5048+
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
5049+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
5050+
50195051
fsevents@^2.3.2, fsevents@~2.3.2:
50205052
version "2.3.3"
50215053
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
@@ -7395,6 +7427,20 @@ pkg-dir@^4.2.0:
73957427
dependencies:
73967428
find-up "^4.0.0"
73977429

7430+
playwright-core@1.49.1:
7431+
version "1.49.1"
7432+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015"
7433+
integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==
7434+
7435+
playwright@1.49.1:
7436+
version "1.49.1"
7437+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c"
7438+
integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==
7439+
dependencies:
7440+
playwright-core "1.49.1"
7441+
optionalDependencies:
7442+
fsevents "2.3.2"
7443+
73987444
portfinder@^1.0.17:
73997445
version "1.0.32"
74007446
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81"
@@ -8507,6 +8553,11 @@ selection-is-backward@^1.0.0:
85078553
resolved "https://registry.yarnpkg.com/selection-is-backward/-/selection-is-backward-1.0.0.tgz#97a54633188a511aba6419fc5c1fa91b467e6be1"
85088554
integrity sha512-C+6PCOO55NLCfS8uQjUKV/6E5XMuUcfOVsix5m0QqCCCKi495NgeQVNfWtAaD71NKHsdmFCJoXUGfir3qWdr9A==
85098555

8556+
semver@7.6.3:
8557+
version "7.6.3"
8558+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
8559+
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
8560+
85108561
semver@^6.0.0, semver@^6.3.0, semver@^6.3.1:
85118562
version "6.3.1"
85128563
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
@@ -9336,6 +9387,11 @@ tslib@2.6.2, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.
93369387
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
93379388
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
93389389

9390+
tslib@2.8.1:
9391+
version "2.8.1"
9392+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
9393+
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
9394+
93399395
tslib@^1.8.1:
93409396
version "1.14.1"
93419397
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@@ -9481,6 +9537,11 @@ typescript@5.5.4:
94819537
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
94829538
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
94839539

9540+
typescript@5.7.3:
9541+
version "5.7.3"
9542+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
9543+
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
9544+
94849545
ua-parser-js@^1.0.32:
94859546
version "1.0.36"
94869547
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.36.tgz#a9ab6b9bd3a8efb90bb0816674b412717b7c428c"
@@ -9591,6 +9652,11 @@ uuid@9.0.1:
95919652
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
95929653
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
95939654

9655+
uuid@^11.0.2:
9656+
version "11.0.5"
9657+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.5.tgz#07b46bdfa6310c92c3fb3953a8720f170427fc62"
9658+
integrity sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==
9659+
95949660
uuid@^8.3.2:
95959661
version "8.3.2"
95969662
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
@@ -9990,6 +10056,11 @@ yaml@^1.10.0:
999010056
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
999110057
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
999210058

10059+
yaml@^2.3.4:
10060+
version "2.7.0"
10061+
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.7.0.tgz#aef9bb617a64c937a9a748803786ad8d3ffe1e98"
10062+
integrity sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==
10063+
999310064
yargs-parser@^21.1.1:
999410065
version "21.1.1"
999510066
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"

0 commit comments

Comments
 (0)