Skip to content

Commit fbd03ae

Browse files
committed
ci(gh-workflows): introduce matrix to test plugin scaffolds against supported / future node versions
1 parent bb85d19 commit fbd03ae

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,98 @@ jobs:
5656
path: ./packed-artifacts
5757
retention-days: 1
5858

59+
test-node-versions:
60+
runs-on: ubuntu-latest
61+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
62+
name: Test node versions
63+
needs: [test]
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
node-version:
68+
- 20
69+
- 22
70+
- 24
71+
env:
72+
WORKING_DIR: 'myorg-nobackend-panel'
73+
steps:
74+
- name: Setup .npmrc file for NPM registry
75+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
registry-url: 'https://registry.npmjs.org'
79+
80+
- name: Download packed artifacts
81+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
82+
with:
83+
name: packed-artifacts
84+
path: ./packed-artifacts
85+
86+
- name: Install npm packages globally
87+
run: for file in *.tgz; do npm install -g "$file"; done
88+
working-directory: ./packed-artifacts
89+
90+
- name: Generate plugin
91+
run: npx create-plugin --plugin-name='no-backend' --org-name='myorg' --plugin-type='panel'
92+
93+
- name: Install generated plugin dependencies
94+
run: npm install --no-audit
95+
working-directory: ./${{ env.WORKING_DIR }}
96+
97+
- name: Lint plugin frontend
98+
run: npm run lint
99+
working-directory: ./${{ env.WORKING_DIR }}
100+
101+
- name: Typecheck plugin frontend
102+
run: npm run typecheck
103+
working-directory: ./${{ env.WORKING_DIR }}
104+
105+
- name: Build plugin frontend
106+
run: npm run build
107+
working-directory: ./${{ env.WORKING_DIR }}
108+
109+
- name: Test plugin frontend
110+
run: npm run test:ci
111+
working-directory: ./${{ env.WORKING_DIR }}
112+
113+
- name: Install playwright dependencies
114+
run: npm exec playwright install --with-deps chromium
115+
working-directory: ./${{ env.WORKING_DIR }}
116+
117+
- name: Start grafana server for e2e tests (10.4.0)
118+
run: |
119+
ANONYMOUS_AUTH_ENABLED=false docker compose build --no-cache
120+
docker compose up -d
121+
env:
122+
GRAFANA_VERSION: '10.4.0'
123+
working-directory: ./${{ env.WORKING_DIR }}
124+
125+
- name: Wait for grafana server (10.4.0)
126+
uses: grafana/plugin-actions/wait-for-grafana@7954f7aa08f1450c1ca49e20be401e4c3f8865f8
127+
with:
128+
url: http://localhost:3000/login
129+
130+
- name: Run e2e tests (10.4.0)
131+
id: run-e2e-tests-min-version
132+
run: npm run e2e
133+
working-directory: ./${{ env.WORKING_DIR }}
134+
135+
- name: Stop grafana docker (10.4.0)
136+
run: docker compose down
137+
working-directory: ./${{ env.WORKING_DIR }}
138+
139+
- name: '@grafana/sign-plugin - use GRAFANA_ACCESS_POLICY_TOKEN to sign generate-panel plugin'
140+
env:
141+
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
142+
run: sign-plugin --rootUrls http://www.example.com --signatureType private
143+
working-directory: ./${{ env.WORKING_DIR }}
144+
145+
- name: '@grafana/sign-plugin - use GRAFANA_API_KEY to sign generate-panel plugin'
146+
env:
147+
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
148+
run: sign-plugin --rootUrls http://www.example.com --signatureType private
149+
working-directory: ./${{ env.WORKING_DIR }}
150+
59151
generate-plugins:
60152
name: Test plugin scaffolding
61153
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"

0 commit comments

Comments
 (0)