Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 5121b6c

Browse files
authored
chore: use @pyroscope/panel-plugin (#6)
* chore: use @pyroscope/panel-plugin
1 parent ed2bd01 commit 5121b6c

File tree

20 files changed

+1824
-315
lines changed

20 files changed

+1824
-315
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22

3+
env:
4+
CYPRESS_CACHE_FOLDER: cypress/cache
5+
36
on:
47
pull_request:
58
branches:
@@ -27,38 +30,37 @@ jobs:
2730
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2831
restore-keys: |
2932
${{ runner.os }}-yarn-
30-
3133
- name: Cache node_modules
3234
id: cache-node-modules
3335
uses: actions/cache@v2
3436
with:
3537
path: node_modules
36-
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
38+
key: ${{ runner.os }}-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
3739
restore-keys: |
38-
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
40+
${{ runner.os }}-${{ matrix.node-version }}-node-modules-
41+
- name: Cache Cypress Binary
42+
id: cache-cypress-binary
43+
uses: actions/cache@v2
44+
with:
45+
path: cypress/cache
46+
key: cypress-binary-${{ hashFiles('yarn.lock') }}
3947

40-
- name: Build plugin
41-
run: yarn build
48+
- name: Pull dependencies
49+
run: yarn
4250

4351
- name: Sign plugin
44-
run: |
45-
# We only have a single dependency, grafana-toolkit
46-
# So we install next to where it's needed
47-
yarn
48-
yarn sign
52+
run: yarn sign
4953
env:
5054
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
5155

52-
# We reuse the same tests from the other repo, after all, why not?
53-
# TODO: run other tests that are valid here
54-
# eg: checking README etc
56+
# Smoke test
57+
# We already tested it extensively in the other repository
5558
- name: Run grafana server
56-
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
59+
run: docker-compose -f docker-compose.yml up -d
5760
- name: Run tests
58-
run: yarn --cwd pyroscope cy:panel:ci
61+
run: yarn cy:ci
5962
env:
6063
CYPRESS_VIDEO: true
61-
CYPRESS_COMPARE_SNAPSHOTS: true
6264
- uses: actions/upload-artifact@v2
6365
if: always()
6466
with:
@@ -69,12 +71,6 @@ jobs:
6971
with:
7072
name: cypress-videos
7173
path: pyroscope/cypress/videos
72-
- uses: actions/upload-artifact@v2
73-
if: always()
74-
with:
75-
name: cypress-snapshots
76-
# TODO: scope to only store screenshots that refer to grafana
77-
path: pyroscope/cypress/snapshots
7874

7975
# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
8076
- name: Setup Go environment

.github/workflows/release.yml

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,55 +29,28 @@ jobs:
2929
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3030
restore-keys: |
3131
${{ runner.os }}-yarn-
32-
3332
- name: Cache node_modules
3433
id: cache-node-modules
3534
uses: actions/cache@v2
3635
with:
3736
path: node_modules
38-
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
37+
key: ${{ runner.os }}-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
3938
restore-keys: |
40-
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
41-
42-
- name: Build plugin
43-
run: yarn build
39+
${{ runner.os }}-${{ matrix.node-version }}-node-modules-
40+
- name: Cache Cypress Binary
41+
id: cache-cypress-binary
42+
uses: actions/cache@v2
43+
with:
44+
path: cypress/cache
45+
key: cypress-binary-${{ hashFiles('yarn.lock') }}
4446

47+
- name: Pull dependencies
48+
run: yarn
4549
- name: Sign plugin
46-
run: |
47-
# We only have a single dependency, grafana-toolkit
48-
# So we install next to where it's needed
49-
yarn
50-
yarn sign
50+
run: yarn sign
5151
env:
5252
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
5353

54-
# We reuse the same tests from the other repo, after all, why not?
55-
# TODO: run other tests that are valid here
56-
# eg: checking README etc
57-
- name: Run grafana server
58-
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
59-
- name: Run tests
60-
run: yarn --cwd pyroscope cy:panel:ci
61-
env:
62-
CYPRESS_VIDEO: true
63-
CYPRESS_COMPARE_SNAPSHOTS: true
64-
- uses: actions/upload-artifact@v2
65-
if: always()
66-
with:
67-
name: cypress-screenshots
68-
path: pyroscope/cypress/screenshots
69-
- uses: actions/upload-artifact@v2
70-
if: always()
71-
with:
72-
name: cypress-videos
73-
path: pyroscope/cypress/videos
74-
- uses: actions/upload-artifact@v2
75-
if: always()
76-
with:
77-
name: cypress-snapshots
78-
# TODO: scope to only store screenshots that refer to grafana
79-
path: pyroscope/cypress/snapshots
80-
8154
# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
8255
- name: Setup Go environment
8356
if: steps.check-for-backend.outputs.has-backend == 'true'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ e2e-results/
3030
# Editors
3131
.idea
3232

33-
src/flamegraphComponent.js
34-
pyroscope
3533
dist.zip
3634
plugin-validator
35+
36+
cypress/videos

CHANGELOG.md

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

LICENSE

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

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
# Pyroscope Grafana Panel Plugin
22

3+
# Usage
34
For more info see [pyroscope-panel plugin for Grafana | Grafana Labs](https://grafana.com/grafana/plugins/pyroscope-panel/)
4-
or [pyroscope/grafana-plugin/panel at main · pyroscope-io/pyroscope](https://github.com/pyroscope-io/pyroscope/tree/main/grafana-plugin/panel)
5+
or the source code [pyroscope/packages/pyroscope-panel-plugin at main · pyroscope-io/pyroscope](https://github.com/pyroscope-io/pyroscope/tree/main/packages/pyroscope-panel-plugin)
56

67

8+
# Raison d'etre
9+
The actual plugin development happens in the [main repo](https://github.com/pyroscope-io/pyroscope/tree/main/packages/pyroscope-panel-plugin).
10+
11+
This repository is a simple wrapper around the `@pyroscope/panel-plugin` library.
12+
It simply packages it, signs it and make a github release.
13+
It does this for a couple reasons:
14+
* So that we control the actual plugin release (since `@pyroscope/panel-plugin` release is automated)
15+
* So that it's cleaner for users (The main repo releases refer to the pyroscope binary itself)
16+
717
# Releasing new versions
8-
1. Update the `UPSTREAM_BRANCH` in `build-panel.sh`
9-
2. Update CHANGELOG.md
10-
3. Bump the version in `package.json`
11-
4. Merge to the main branch.
18+
1. Update the `@pyroscope/panel-plugin` dependency
19+
2. Open a Pull Request and merge it
20+
3. Submit the new plugin version in Grafana Cloud (https://grafana.com/docs/grafana/latest/developers/plugins/package-a-plugin/#maintain-your-plugin)
21+

0 commit comments

Comments
 (0)