Skip to content

Commit 8032648

Browse files
authored
Merge pull request #171 from Platane/e2e-version-matrix
Update e2e tests
2 parents 5b0a6ae + 66b52a7 commit 8032648

File tree

16 files changed

+1290
-5705
lines changed

16 files changed

+1290
-5705
lines changed

.config/bundler/externals.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
3+
*
4+
*/
5+
6+
import type { Configuration, ExternalItemFunctionData } from 'webpack';
7+
8+
type ExternalsType = Configuration['externals'];
9+
10+
export const externals: ExternalsType = [
11+
// Required for dynamic publicPath resolution
12+
{ 'amd-module': 'module' },
13+
'lodash',
14+
'jquery',
15+
'moment',
16+
'slate',
17+
'emotion',
18+
'@emotion/react',
19+
'@emotion/css',
20+
'prismjs',
21+
'slate-plain-serializer',
22+
'@grafana/slate-react',
23+
'react',
24+
'react/jsx-runtime',
25+
'react/jsx-dev-runtime',
26+
'react-dom',
27+
'react-redux',
28+
'redux',
29+
'rxjs',
30+
'i18next',
31+
'react-router',
32+
'd3',
33+
'angular',
34+
/^@grafana\/ui/i,
35+
/^@grafana\/runtime/i,
36+
/^@grafana\/data/i,
37+
38+
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
39+
({ request }: ExternalItemFunctionData, callback: (error?: Error, result?: string) => void) => {
40+
const prefix = 'grafana/';
41+
const hasPrefix = (request: string) => request.indexOf(prefix) === 0;
42+
const stripPrefix = (request: string) => request.slice(prefix.length);
43+
44+
if (request && hasPrefix(request)) {
45+
return callback(undefined, stripPrefix(request));
46+
}
47+
48+
callback();
49+
},
50+
];

.config/webpack/webpack.config.ts

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { Configuration } from 'webpack';
1616
import { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL } from './utils';
1717
import { SOURCE_DIR, DIST_DIR } from './constants';
1818

19+
import { externals } from '../bundler/externals.ts';
20+
1921
const pluginJson = getPluginJson();
2022

2123
const config = async (env): Promise<Configuration> => {
@@ -33,43 +35,7 @@ const config = async (env): Promise<Configuration> => {
3335

3436
entry: await getEntries(),
3537

36-
externals: [
37-
'lodash',
38-
'jquery',
39-
'moment',
40-
'slate',
41-
'emotion',
42-
'@emotion/react',
43-
'@emotion/css',
44-
'prismjs',
45-
'slate-plain-serializer',
46-
'@grafana/slate-react',
47-
'react',
48-
'react-dom',
49-
'react-redux',
50-
'redux',
51-
'rxjs',
52-
'react-router',
53-
'react-router-dom',
54-
'd3',
55-
'angular',
56-
'@grafana/ui',
57-
'@grafana/runtime',
58-
'@grafana/data',
59-
60-
// Mark legacy SDK imports as external if their name starts with the "grafana/" prefix
61-
({ request }, callback) => {
62-
const prefix = 'grafana/';
63-
const hasPrefix = (request) => request.indexOf(prefix) === 0;
64-
const stripPrefix = (request) => request.substr(prefix.length);
65-
66-
if (hasPrefix(request)) {
67-
return callback(undefined, stripPrefix(request));
68-
}
69-
70-
callback();
71-
},
72-
],
38+
externals,
7339

7440
mode: env.production ? 'production' : 'development',
7541

.github/workflows/ci.yml

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
17+
outputs:
18+
e2e-matrix: ${{ steps.resolve-versions.outputs.matrix }}
1719
steps:
1820
- uses: actions/checkout@v6
1921
- name: Setup Node.js environment
@@ -22,6 +24,12 @@ jobs:
2224
node-version: '22'
2325
cache: 'npm'
2426

27+
- name: Cache node_modules for future jobs
28+
uses: actions/cache@v4
29+
with:
30+
path: node_modules
31+
key: node-modules-${{ hashFiles('package-lock.json') }}
32+
2533
- name: Install dependencies
2634
run: npm ci
2735

@@ -34,15 +42,6 @@ jobs:
3442
- name: Build frontend
3543
run: npm run build
3644

37-
- name: Start grafana docker
38-
run: docker compose up -d
39-
40-
- name: Run e2e tests
41-
run: npm run e2e
42-
43-
- name: Stop grafana docker
44-
run: docker compose down
45-
4645
- name: Check for backend
4746
id: check-for-backend
4847
run: |
@@ -70,3 +69,69 @@ jobs:
7069
with:
7170
version: latest
7271
args: buildAll
72+
73+
- name: Upload build artifact
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: dist
77+
path: dist/
78+
79+
- name: Resolve Grafana E2E versions
80+
id: resolve-versions
81+
uses: grafana/plugin-actions/e2e-version@e2e-version/v1.2.1
82+
with:
83+
skip-grafana-react-19-preview-image: false
84+
85+
e2e:
86+
runs-on: ubuntu-latest
87+
timeout-minutes: 15
88+
needs: build
89+
strategy:
90+
fail-fast: false
91+
matrix:
92+
GRAFANA_IMAGE: ${{ fromJson(needs.build.outputs.e2e-matrix) }}
93+
QUICKWIT_VERSION: [edge]
94+
steps:
95+
- uses: actions/checkout@v6
96+
97+
- name: Download build artifact
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: dist
101+
path: dist/
102+
103+
- name: Restore executable permissions
104+
run: chmod +x dist/gpx_quickwit_*
105+
106+
- name: Setup Node.js environment
107+
uses: actions/setup-node@v6
108+
with:
109+
node-version: '22'
110+
111+
- name: Restore node_modules
112+
uses: actions/cache/restore@v4
113+
with:
114+
path: node_modules
115+
key: node-modules-${{ hashFiles('package-lock.json') }}
116+
117+
- name: Install Playwright
118+
run: npx playwright install --with-deps chromium
119+
120+
- name: Start Grafana (${{ matrix.GRAFANA_IMAGE.name }}:${{ matrix.GRAFANA_IMAGE.version }}) + Quickwit (${{ matrix.QUICKWIT_VERSION }})
121+
run: docker compose up -d --build
122+
env:
123+
GRAFANA_VERSION: ${{ matrix.GRAFANA_IMAGE.version }}
124+
GRAFANA_IMAGE: ${{ matrix.GRAFANA_IMAGE.name }}
125+
QUICKWIT_VERSION: ${{ matrix.QUICKWIT_VERSION }}
126+
127+
- name: Wait for Grafana and Quickwit to start
128+
run: |
129+
timeout 60 bash -c 'until curl -sf http://localhost:3000/api/health; do sleep 2; done' || { docker compose logs grafana; exit 1; }
130+
timeout 60 bash -c 'until curl -sf http://localhost:7280/health/readyz; do sleep 2; done' || { docker compose logs quickwit; exit 1; }
131+
132+
- name: Run e2e tests
133+
run: npm run e2e
134+
135+
- name: Stop Grafana
136+
if: always()
137+
run: docker compose down

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ artifacts/
3131
work/
3232
ci/
3333
e2e-results/
34-
**/cypress/videos
35-
**/cypress/report.json
34+
playwright-report/
35+
test-results/
36+
playwright/.auth/
3637

3738
# Editor
3839
.idea

cypress.json

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

cypress/integration/01-smoke.spec.ts

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

docker-compose.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.0'
22

33
services:
44
quickwit:
5-
image: quickwit/quickwit:edge
5+
image: quickwit/quickwit:${QUICKWIT_VERSION:-edge}
66
environment:
77
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:7281
88
- QW_ENABLE_OPENTELEMETRY_OTLP_EXPORTER=true
@@ -16,7 +16,8 @@ services:
1616
build:
1717
context: ./.config
1818
args:
19-
grafana_version: 12.1.0
19+
grafana_version: ${GRAFANA_VERSION:-12.4.0}
20+
grafana_image: ${GRAFANA_IMAGE:-grafana-oss}
2021
ports:
2122
- 3000:3000/tcp
2223
volumes:

0 commit comments

Comments
 (0)