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

Pr rewrite grafana7 #14

Merged
merged 2 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 0 additions & 19 deletions .babelrc

This file was deleted.

16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.{js,ts,tsx,scss}]
quote_type = single

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

name: ci

on:
push:
tags:
- 'v*.*.*'

env:
CONSUL_VERSION: '1.8.4'
GOLANGCI_LINT_VERSION: '1.32.2'
MAGE_VERSION: '1.10.0'
NODE_VERSION: '12.x'
YARN_VERSION: '1.21.1'

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Get the version & set it in package.json
id: get_version
run: |
VERSION=${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=VERSION::${VERSION}
sed -i "s/1.0.0/${VERSION}/g" package.json

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install Consul
run: |
# Install some binaries when not running locally
if ! command -v sudo &> /dev/null
then
apt update
# procps required to execute syctl to find free ports for Consul
apt install zip unzip procps -y
fi

mkdir -p $GITHUB_WORKSPACE/bin
curl -sLo consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip
unzip consul.zip
rm -rf consul.zip
mv consul $GITHUB_WORKSPACE/bin
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Install Mage
uses: nickhstr/action-setup-mage@v1.0.0
with:
version: ${{ env.MAGE_VERSION }}

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v${{ env.GOLANGCI_LINT_VERSION }}

- name: Build and test frontend
run: |
yarn install
./node_modules/.bin/grafana-toolkit plugin:ci-build

- name: Build and test backend
run: |
mage -v buildAll
export CGO_ENABLED=0
mage -v lint
mage -v coverage

- name: Move results to ci folder and package distro
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
run: |
./node_modules/.bin/grafana-toolkit plugin:ci-build --finish
./node_modules/.bin/grafana-toolkit plugin:ci-package

ls -la ./ci/jobs/package
ls -la ./ci/packages
ls -la ./ci/dist
ls -la ./ci/grafana-test-env

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
TODO: change me
draft: true
prerelease: false

- name: Upload plugin to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ci/packages/sbueringer-consul-datasource-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: sbueringer-consul-datasource-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
37 changes: 27 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

*.iml
node_modules/

# Build artifacts
/.tscache
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Test artifacts
/dist/src
/dist/test
/dist/spec
/.nyc_output
/coverage
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Compiled binary addons (https://nodejs.org/api/addons.html)
dist/
artifacts/
work/
ci/
e2e-results/

# Editor
.idea
32 changes: 32 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
run:
deadline: 10m

concurrency: 4

# skip-dirs:
# - vendor/

# skip-files:

linters:
disable-all: true
fast: false
enable:
- goimports
- golint
- govet
- gofmt
- structcheck
- staticcheck
- varcheck
- interfacer
- unconvert
- ineffassign
- goconst
- misspell
- nakedret
- deadcode

issues:
max-issues-per-linter: 100
max-same-issues: 50
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require("./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json"),
};
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# v0.1.9 - 2020-11-11

Complete rewrite of the plugin for Grafana 7.x.

Highlights:
* Anonymous Consul authentication (without token)
* Plugin is now signed
Loading