Skip to content

Commit 3c91fbc

Browse files
committed
WIP: Run E2E against Grafana Cloud
1 parent 680a2ea commit 3c91fbc

File tree

2 files changed

+134
-1
lines changed

2 files changed

+134
-1
lines changed

.github/workflows/cloud-e2e.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Grafana Cloud E2E tests
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * *' # Daily at 09:00 UTC
6+
7+
# TODO: test, remove later
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
13+
jobs:
14+
# @TODO: Remove the `build` job later
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
with:
20+
persist-credentials: false
21+
22+
- uses: actions/setup-go@v6
23+
with:
24+
go-version: 'stable'
25+
26+
- name: Build backend
27+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b
28+
with:
29+
args: buildAll
30+
version: latest
31+
32+
- name: Install frontend dependencies
33+
run: npm ci
34+
35+
- name: Build frontend
36+
run: npm run build
37+
env:
38+
NODE_OPTIONS: '--max_old_space_size=4096'
39+
40+
- name: Upload dist artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: dist-artifacts
44+
path: dist
45+
46+
e2e:
47+
name: Grafana Cloud E2E Tests
48+
needs: build
49+
runs-on: ubuntu-latest
50+
51+
permissions:
52+
contents: read
53+
id-token: write
54+
55+
steps:
56+
- uses: actions/checkout@v5
57+
with:
58+
persist-credentials: false
59+
60+
- name: Setup Node.js environment
61+
uses: actions/setup-node@v6
62+
with:
63+
node-version-file: .nvmrc
64+
cache: 'npm'
65+
66+
- name: Download GitHub artifact
67+
uses: actions/download-artifact@v5
68+
with:
69+
name: dist-artifacts
70+
path: ./dist
71+
72+
# - name: Move dist artifacts
73+
# run: |
74+
# rm -rf dist
75+
# mkdir -p dist
76+
# src=$(pwd)
77+
78+
# cd /tmp/dist-artifacts
79+
# # unzip the universal zip
80+
# unzip "${PLUGIN_ID}-${PLUGIN_VERSION}.zip" -d out
81+
# # Folder structure: /tmp/dist-artifacts/out/$PLUGIN_ID/plugin.json
82+
# cd out
83+
# cd "$(ls -1)"
84+
# mv ./* "$src/dist/"
85+
# env:
86+
# PLUGIN_ID: clickhouse-datasource
87+
# PLUGIN_VERSION: 4.11.1
88+
89+
- name: Get secrets from Vault
90+
id: get-secrets
91+
uses: grafana/shared-workflows/actions/get-vault-secrets@get-vault-secrets/v1.3.0
92+
with:
93+
# Secrets placed in the ci/common/<path> path in Vault
94+
common_secrets: |
95+
PLAYWRIGHT_GRAFANA_USERNAME=data-sources/e2e:grafana-username
96+
PLAYWRIGHT_GRAFANA_PASSWORD=data-sources/e2e:grafana-pw
97+
# Secrets placed in the ci/repo/grafana/<repo>/<path> path in Vault
98+
# repo_secrets: |
99+
# ENVVAR2=test-secret:key1
100+
101+
- name: Install npm dependencies
102+
run: |
103+
if [ -f yarn.lock ]; then
104+
yarn install --frozen-lockfile
105+
else
106+
npm ci
107+
fi
108+
shell: bash
109+
110+
- name: Install Playwright Browsers
111+
run: npx playwright install --with-deps chromium
112+
113+
- name: Wait for Grafana to start
114+
uses: grafana/plugin-actions/wait-for-grafana@wait-for-grafana/v1.0.2
115+
with:
116+
url: "https://datasourcese2e.grafana-dev.net/login"
117+
118+
- name: Run Grafana Bench tests
119+
run: |
120+
docker run \
121+
--rm \
122+
--network=host \
123+
--volume="./:/tests/" \
124+
us-docker.pkg.dev/grafanalabs-global/docker-grafana-bench-prod/grafana-bench-playwright:v0.6.3 test \
125+
--grafana-admin-password "${{ env.PLAYWRIGHT_GRAFANA_PASSWORD }}" \
126+
--grafana-admin-user "${{ env.PLAYWRIGHT_GRAFANA_USERNAME }}" \
127+
--grafana-url "https://datasourcese2e.grafana-dev.net" \
128+
--log-level debug \
129+
--pw-execute "npm run e2e" \
130+
--pw-prepare "npm install --frozen-lockfile; npx playwright install" \
131+
--test-env-vars "CI=true" \
132+
--test-runner playwright
133+

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
contents: read
1717
id-token: write
1818
with:
19-
plugin-version-suffix: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
2019
go-version: '1.24'
2120
golangci-lint-version: '2.1.6'
21+
plugin-version-suffix: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}

0 commit comments

Comments
 (0)