@grafana/create-plugin 4.7.0-canary.883.3635606.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v4.7.0 (Thu Apr 18 2024)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Create Plugin: Run e2e tests against multiple Grafana versions in CI workflow [#870](https://github.com/grafana/plugin-tools/pull/870) ([@sunker](https://github.com/sunker))
6
+
7
+ #### Authors: 1
8
+
9
+ - Erik Sundell ([@sunker](https://github.com/sunker))
10
+
11
+ ---
12
+
1
13
  # v4.6.2 (Wed Apr 17 2024)
2
14
 
3
15
  #### 🐛 Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "4.7.0-canary.883.3635606.0",
3
+ "version": "4.7.0",
4
4
  "repository": {
5
5
  "directory": "packages/create-plugin",
6
6
  "url": "https://github.com/grafana/plugin-tools"
@@ -87,5 +87,5 @@
87
87
  "engines": {
88
88
  "node": ">=20"
89
89
  },
90
- "gitHead": "36356061f59c5a0fd16e9413ac4c50e666033525"
90
+ "gitHead": "b18692d9bdc211888da99627436f58b1229d88ad"
91
91
  }
@@ -11,7 +11,6 @@ services:
11
11
  args:
12
12
  grafana_image: ${GRAFANA_IMAGE:-{{~grafanaImage~}} }
13
13
  grafana_version: ${GRAFANA_VERSION:-{{~grafanaVersion~}} }
14
- development: ${DEVELOPMENT:-true}
15
14
  ports:
16
15
  - 3000:3000/tcp
17
16
  {{#if hasBackend}}
@@ -15,7 +15,13 @@ permissions: read-all
15
15
 
16
16
  jobs:
17
17
  build:
18
+ name: Build, lint and unit tests
18
19
  runs-on: ubuntu-latest
20
+ outputs:
21
+ plugin-id: $\{{ steps.metadata.outputs.plugin-id }}
22
+ plugin-version: $\{{ steps.metadata.outputs.plugin-version }}
23
+ has-e2e: $\{{ steps.check-for-e2e.outputs.has-e2e }}
24
+ has-backend: $\{{ steps.check-for-backend.outputs.has-backend }}
19
25
  env:
20
26
  GRAFANA_ACCESS_POLICY_TOKEN: $\{{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
21
27
  steps:
@@ -79,42 +85,6 @@ jobs:
79
85
  echo "has-e2e=true" >> $GITHUB_OUTPUT
80
86
  fi
81
87
 
82
- - name: Install Playwright Browsers
83
- if: steps.check-for-e2e.outputs.has-e2e == 'true'
84
- run: {{ packageManagerName }} exec playwright install --with-deps
85
-
86
- - name: Start grafana docker
87
- if: steps.check-for-e2e.outputs.has-e2e == 'true'
88
- run: docker-compose up -d
89
- env:
90
- DEVELOPMENT: "false"
91
-
92
- - name: Wait for Grafana to start
93
- if: steps.check-for-e2e.outputs.has-e2e == 'true'
94
- uses: nev7n/wait_for_response@v1
95
- with:
96
- url: 'http://localhost:3000/'
97
- responseCode: 200
98
- timeout: 60000
99
- interval: 500
100
-
101
- - name: Run e2e tests
102
- id: run-e2e-tests
103
- if: steps.check-for-e2e.outputs.has-e2e == 'true'
104
- run: {{ packageManagerName }} run e2e
105
-
106
- - name: Stop grafana docker
107
- if: steps.check-for-e2e.outputs.has-e2e == 'true'
108
- run: docker-compose down
109
-
110
- - name: Archive E2E output
111
- uses: actions/upload-artifact@v4
112
- if: steps.check-for-e2e.outputs.has-e2e == 'true' && steps.run-e2e-tests.outcome != 'success'
113
- with:
114
- name: playwright-report
115
- path: playwright-report/
116
- retention-days: 5
117
-
118
88
  - name: Sign plugin
119
89
  run: {{ packageManagerName }} run sign
120
90
  if: $\{{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }}
@@ -144,3 +114,107 @@ jobs:
144
114
  name: $\{{ steps.metadata.outputs.plugin-id }}-$\{{ steps.metadata.outputs.plugin-version }}
145
115
  path: $\{{ steps.metadata.outputs.plugin-id }}
146
116
  retention-days: 5
117
+
118
+ resolve-versions:
119
+ name: Resolve e2e images
120
+ runs-on: ubuntu-latest
121
+ timeout-minutes: 3
122
+ needs: build
123
+ if: $\{{ needs.build.outputs.has-e2e == 'true' }}
124
+ outputs:
125
+ matrix: $\{{ steps.resolve-versions.outputs.matrix }}
126
+ steps:
127
+ - name: Checkout
128
+ uses: actions/checkout@v4
129
+ - name: Resolve Grafana E2E versions
130
+ id: resolve-versions
131
+ uses: grafana/plugin-actions/e2e-version@main
132
+
133
+ playwright-tests:
134
+ needs: [resolve-versions, build]
135
+ timeout-minutes: 15
136
+ strategy:
137
+ fail-fast: false
138
+ matrix:
139
+ GRAFANA_IMAGE: $\{{fromJson(needs.resolve-versions.outputs.matrix)}}
140
+ name: e2e test $\{{ matrix.GRAFANA_IMAGE.name }}@$\{{ matrix.GRAFANA_IMAGE.VERSION }}
141
+ runs-on: ubuntu-latest
142
+ steps:
143
+ - uses: actions/checkout@v4
144
+ with:
145
+ sparse-checkout: |
146
+ provisioning
147
+ tests
148
+ .config
149
+
150
+ - name: Download plugin
151
+ if: needs.build.outputs.has-backend == 'true'
152
+ uses: actions/download-artifact@v4
153
+ with:
154
+ path: dist
155
+ name: $\{{ needs.build.outputs.plugin-id }}-$\{{ needs.build.outputs.plugin-version }}
156
+
157
+ - name: Execute permissions on binary
158
+ if: needs.build.outputs.has-backend == 'true'
159
+ run: |
160
+ chmod +x ./dist/gpx_cicd_linux_amd64
161
+
162
+ {{#if_eq packageManagerName "pnpm"}}
163
+ # pnpm action uses the packageManager field in package.json to
164
+ # understand which version to install.
165
+ - uses: pnpm/action-setup@v3
166
+ {{/if_eq}}
167
+ - name: Setup Node.js environment
168
+ uses: actions/setup-node@v4
169
+ with:
170
+ node-version: '20'
171
+ cache: '{{ packageManagerName }}'
172
+
173
+ - name: Install dev dependencies
174
+ run: {{ packageManagerInstallCmd }}
175
+
176
+ - name: Start Grafana
177
+ run: |
178
+ docker-compose pull
179
+ GRAFANA_VERSION=$\{{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=$\{{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
180
+
181
+ - name: Wait for Grafana to start
182
+ uses: nev7n/wait_for_response@v1
183
+ with:
184
+ url: 'http://localhost:3000/'
185
+ responseCode: 200
186
+ timeout: 60000
187
+ interval: 500
188
+
189
+ - name: Install Playwright Browsers
190
+ run: npx playwright install chromium --with-deps
191
+
192
+ - name: Run Playwright tests
193
+ id: run-tests
194
+ run: {{ packageManagerName }} run e2e
195
+
196
+ - name: Docker logs
197
+ if: $\{{ always() && steps.run-tests.outcome == 'failure' }}
198
+ run: |
199
+ docker logs {{ pluginId }} >& grafana-server.log
200
+
201
+ - name: Stop grafana docker
202
+ run: docker-compose down
203
+
204
+ - name: Upload server log
205
+ uses: actions/upload-artifact@v4
206
+ if: $\{{ always() && steps.run-tests.outcome == 'failure' }}
207
+ with:
208
+ name: $\{{ matrix.GRAFANA_IMAGE.NAME }}-v$\{{ matrix.GRAFANA_IMAGE.VERSION }}-$\{{github.run_id}}-server-log
209
+ path: grafana-server.log
210
+ retention-days: 5
211
+
212
+ # If your repository is public, uploading the Playwright report will make it public on the Internet.
213
+ # Beware not to expose sensitive information.
214
+ - name: Upload artifacts
215
+ uses: actions/upload-artifact@v4
216
+ if: $\{{ always() && steps.run-tests.outcome == 'failure' }}
217
+ with:
218
+ name: playwright-report-$\{{ matrix.GRAFANA_IMAGE.NAME }}-v$\{{ matrix.GRAFANA_IMAGE.VERSION }}-$\{{github.run_id}}
219
+ path: playwright-report/
220
+ retention-days: 5