Skip to content

Commit

Permalink
build: update Makefile, remove compiled json dashboards, update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Jul 23, 2020
1 parent 2dc27cd commit 706b9b9
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 4,439 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@ jobs:
with:
node-version: 12

- name: Install dependencies
- name: Installing jsonnet and jsonnet-bundler
run: |
go get github.com/google/go-jsonnet/cmd/jsonnet
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
echo "::add-path::$HOME/go/bin"
- name: Install Node.js dependencies
run: make node_modules

- name: Install jsonnet dependencies
run: make vendor

- name: Build
run: make build

- name: Test
run: make test

- name: Publish build artifact
uses: actions/upload-artifact@v2
with:
name: grafana-pcp
path: dist
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ e2e-results/
# Editor
.idea

# Jsonnet Bundler
vendor/
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# build grafana-pcp
#
YARN = yarn
JSONNET = jsonnet
JSONNETBUNDLER = jb

DASHBOARD_DIR := src/dashboards
JSONNET_DEPS := src/dashboard/jsonnetfile.json
DASHBOARDS := $(addprefix $(DASHBOARD_DIR)/,pcp-vector-host-overview.json pcp-vector-container-overview-cgroups1.json pcp-vector-container-overview-cgroups2.json pcp-vector-bcc-overview.json fulltext-graph-preview.json fulltext-table-preview.json)

default: build
Expand All @@ -12,26 +14,25 @@ node_modules: package.json
$(YARN) install
sed -i '[email protected](createIgnoreResult(filePath, cwd));@// &@' node_modules/eslint/lib/cli-engine/cli-engine.js

$(JSONNET_DEPS):
cd $(DASHBOARD_DIR) && jb install
vendor: jsonnetfile.json
$(JSONNETBUNDLER) install

$(DASHBOARD_DIR)/%.json: $(DASHBOARD_DIR)/%.jsonnet
cd src/dashboards && jb install
jsonnet -o $@ $<
$(JSONNET) -J vendor -o $@ $<

dist: node_modules $(JSONNET_DEPS) $(DASHBOARDS)
dist: node_modules vendor $(DASHBOARDS)
$(YARN) run build

build: dist

dev: node_modules $(DASHBOARDS)
dev: node_modules vendor $(DASHBOARDS)
$(YARN) run dev

watch: $(DASHBOARDS)
watch: node_modules vendor $(DASHBOARDS)
$(YARN) run watch

test: node_modules
$(YARN) run test

clean:
rm -rf node_modules dist
rm -rf node_modules vendor dist
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/dashboards/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
vendor
*.json
173 changes: 0 additions & 173 deletions src/dashboards/fulltext-graph-preview.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/dashboards/fulltext-graph-preview.jsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local grafana = import 'vendor/grafonnet/grafana.libsonnet';
local grafana = import 'grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;
local template = grafana.template;
local graphPanel = grafana.graphPanel;
Expand Down
114 changes: 0 additions & 114 deletions src/dashboards/fulltext-table-preview.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/dashboards/fulltext-table-preview.jsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local grafana = import 'vendor/grafonnet/grafana.libsonnet';
local grafana = import 'grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;
local template = grafana.template;
local tablePanel = grafana.tablePanel;
Expand Down
Loading

0 comments on commit 706b9b9

Please sign in to comment.