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

Commit

Permalink
chore: use @pyroscope/panel-plugin (#6)
Browse files Browse the repository at this point in the history
* chore: use @pyroscope/panel-plugin
  • Loading branch information
eh-am authored Feb 24, 2022
1 parent ed2bd01 commit 5121b6c
Show file tree
Hide file tree
Showing 20 changed files with 1,824 additions and 315 deletions.
40 changes: 18 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

env:
CYPRESS_CACHE_FOLDER: cypress/cache

on:
pull_request:
branches:
Expand Down Expand Up @@ -27,38 +30,37 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
${{ runner.os }}-${{ matrix.node-version }}-node-modules-
- name: Cache Cypress Binary
id: cache-cypress-binary
uses: actions/cache@v2
with:
path: cypress/cache
key: cypress-binary-${{ hashFiles('yarn.lock') }}

- name: Build plugin
run: yarn build
- name: Pull dependencies
run: yarn

- name: Sign plugin
run: |
# We only have a single dependency, grafana-toolkit
# So we install next to where it's needed
yarn
yarn sign
run: yarn sign
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.

# We reuse the same tests from the other repo, after all, why not?
# TODO: run other tests that are valid here
# eg: checking README etc
# Smoke test
# We already tested it extensively in the other repository
- name: Run grafana server
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
run: docker-compose -f docker-compose.yml up -d
- name: Run tests
run: yarn --cwd pyroscope cy:panel:ci
run: yarn cy:ci
env:
CYPRESS_VIDEO: true
CYPRESS_COMPARE_SNAPSHOTS: true
- uses: actions/upload-artifact@v2
if: always()
with:
Expand All @@ -69,12 +71,6 @@ jobs:
with:
name: cypress-videos
path: pyroscope/cypress/videos
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-snapshots
# TODO: scope to only store screenshots that refer to grafana
path: pyroscope/cypress/snapshots

# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
- name: Setup Go environment
Expand Down
49 changes: 11 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,55 +29,28 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
- name: Build plugin
run: yarn build
${{ runner.os }}-${{ matrix.node-version }}-node-modules-
- name: Cache Cypress Binary
id: cache-cypress-binary
uses: actions/cache@v2
with:
path: cypress/cache
key: cypress-binary-${{ hashFiles('yarn.lock') }}

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

# We reuse the same tests from the other repo, after all, why not?
# TODO: run other tests that are valid here
# eg: checking README etc
- name: Run grafana server
run: docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
- name: Run tests
run: yarn --cwd pyroscope cy:panel:ci
env:
CYPRESS_VIDEO: true
CYPRESS_COMPARE_SNAPSHOTS: true
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-screenshots
path: pyroscope/cypress/screenshots
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-videos
path: pyroscope/cypress/videos
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-snapshots
# TODO: scope to only store screenshots that refer to grafana
path: pyroscope/cypress/snapshots

# Setup the go environment, since the grafana plugin linter isn't distributed as a binary
- name: Setup Go environment
if: steps.check-for-backend.outputs.has-backend == 'true'
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ e2e-results/
# Editors
.idea

src/flamegraphComponent.js
pyroscope
dist.zip
plugin-validator

cypress/videos
16 changes: 0 additions & 16 deletions CHANGELOG.md

This file was deleted.

201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Pyroscope Grafana Panel Plugin

# Usage
For more info see [pyroscope-panel plugin for Grafana | Grafana Labs](https://grafana.com/grafana/plugins/pyroscope-panel/)
or [pyroscope/grafana-plugin/panel at main · pyroscope-io/pyroscope](https://github.com/pyroscope-io/pyroscope/tree/main/grafana-plugin/panel)
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)


# Raison d'etre
The actual plugin development happens in the [main repo](https://github.com/pyroscope-io/pyroscope/tree/main/packages/pyroscope-panel-plugin).

This repository is a simple wrapper around the `@pyroscope/panel-plugin` library.
It simply packages it, signs it and make a github release.
It does this for a couple reasons:
* So that we control the actual plugin release (since `@pyroscope/panel-plugin` release is automated)
* So that it's cleaner for users (The main repo releases refer to the pyroscope binary itself)

# Releasing new versions
1. Update the `UPSTREAM_BRANCH` in `build-panel.sh`
2. Update CHANGELOG.md
3. Bump the version in `package.json`
4. Merge to the main branch.
1. Update the `@pyroscope/panel-plugin` dependency
2. Open a Pull Request and merge it
3. Submit the new plugin version in Grafana Cloud (https://grafana.com/docs/grafana/latest/developers/plugins/package-a-plugin/#maintain-your-plugin)

Loading

0 comments on commit 5121b6c

Please sign in to comment.