Skip to content

Commit

Permalink
Grafana upgrade (#1417)
Browse files Browse the repository at this point in the history
* chore: use yarn

* fix: update to latest Grafana

* chore: use yarn on CI

* fix: use yarn on Makefile

* fix: 2.32.0 version

* chore: remove node matrix

* deps: [email protected]

* fix:  ButtonProps

Co-authored-by: Alex Tymchuk <[email protected]>
  • Loading branch information
fabio-silva and Alex Tymchuk authored Dec 7, 2022
1 parent dcc3a83 commit 8d63972
Show file tree
Hide file tree
Showing 20 changed files with 15,677 additions and 55,281 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@ on: pull_request
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: percona-platform/checkout@v2
- name: Checkout code
uses: percona-platform/checkout@v2

- name: Build grafana-dashboards
- name: Run with Node 16
uses: percona-platform/setup-node@v2
with:
node-version: "16"
cache: "npm"
cache-dependency-path: pmm-app/package-lock.json

- run: make prepare_release
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Use Yarn cache
uses: percona-platform/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-16-${{ hashFiles('**/yarn.lock') }}

- name: Install deps
run: make prepare_release

- run: make build_package
- name: Build Grafana Dashboards
run: make build_package

- name: Upload the build artefacts
uses: percona-platform/upload-artifact@v2
Expand All @@ -30,16 +40,13 @@ jobs:
code_coverage:
needs: build
runs-on: ubuntu-latest

steps:
- uses: percona-platform/checkout@v2

- name: Setup NodeJS
uses: percona-platform/setup-node@v2
with:
node-version: "16"
cache: "npm"
cache-dependency-path: pmm-app/package-lock.json
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_GRAFANA_DASHBOARDS_TOKEN }}

Expand All @@ -49,9 +56,11 @@ jobs:
name: build-dist
path: pmm-app/dist/

- run: make prepare_release
- name: Install deps
run: make prepare_release

- run: make generate_coverage
- name: Generate Coverage
run: make generate_coverage

workflow_success:
needs: [code_coverage, build]
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ all: build pack disable install enable
.PHONY: coverage
coverage:
cd pmm-app \
&& npm run coverage
&& yarn run coverage

.PHONY: codecov
codecov:
cd pmm-app \
&& npm run codecov
&& yarn run codecov

.PHONY: release
release:
cd pmm-app \
&& npm version \
&& npm ci \
&& npm run build
&& yarn install --frozen-lockfile \
&& yarn run build

.PHONY: prepare_release
prepare_release:
cd pmm-app \
&& npm version \
&& npm ci \
&& yarn install --frozen-lockfile \

.PHONY: build_package
build_package:
cd pmm-app \
&& npm run build
&& yarn run build

.PHONY: generate_coverage
generate_coverage: coverage codecov
Expand Down
11 changes: 11 additions & 0 deletions pmm-app/monkey-patch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const fs = require('fs');

const FILE = './node_modules/@grafana/toolkit/src/config/webpack/loaders.js';

const fileContent = fs.readFileSync(FILE, { encoding: 'utf-8' });

if (fileContent && !fileContent.includes('math: "always"')) {
const result = fileContent.replace('javascriptEnabled: true', 'javascriptEnabled: true, math: "always"');

fs.writeFileSync(FILE, result, { encoding: 'utf-8' });
}
Loading

0 comments on commit 8d63972

Please sign in to comment.