diff --git a/.circleci/config.yml.disabled b/.circleci/config.yml.disabled deleted file mode 100644 index 53979c4..0000000 --- a/.circleci/config.yml.disabled +++ /dev/null @@ -1,227 +0,0 @@ -version: 2.1 - -parameters: - ssh-fingerprint: - type: string - default: ${GITHUB_SSH_FINGERPRINT} - -workflows: - plugin_workflow: - jobs: - - yarn_install - - build_docs: - requires: - - yarn_install - - build_frontend: - requires: - - yarn_install - - code_coverage_setup - - code_coverage_frontend: - requires: - - build_frontend - - code_coverage_setup - - upload_coverage: - requires: - - code_coverage_frontend - - package: - requires: - - build_frontend - - build_docs - -executors: - default_exec: # declares a reusable executor - docker: - - image: srclosson/grafana-plugin-ci-alpine:latest - e2e_exec: - docker: - - image: srclosson/grafana-plugin-ci-e2e:latest - -jobs: - yarn_install: - executor: default_exec - steps: - - checkout - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Install dependencies - command: | - mkdir ci - [ -f ~/project/node_modules/.bin/grafana-toolkit ] || yarn install --frozen-lockfile - - save_cache: - name: save node_modules - paths: - - ~/project/node_modules - key: build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - save_cache: - name: save cypress cache - paths: - - ~/.cache/Cypress - key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - code_coverage_setup: - docker: - - image: circleci/circleci-cli:alpine - steps: - - run: - name: Download cc-test-reporter - command: | - apk --no-cache add curl - mkdir -p ccbin/ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./ccbin/cc-test-reporter - chmod +x ./ccbin/cc-test-reporter - - persist_to_workspace: - root: . - paths: - - ccbin - - ci/jobs/code_coverage_setup - - code_coverage_frontend: - executor: default_exec - steps: - - checkout - - attach_workspace: - at: . - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Run coverage report - command: | - ls -l coverage - ./ccbin/cc-test-reporter format-coverage -t lcov -o out/codeclimate.frontend.json coverage/lcov.info - - run: - name: Install jest and jest-junit - command: yarn global add jest jest-junit - - run: - name: Run tests with JUnit as reporter - command: jest --ci --runInBand --reporters=default --reporters=jest-junit - environment: - JEST_JUNIT_OUTPUT_DIR: "test-results/jest/results.xml" - - persist_to_workspace: - root: . - paths: - - out - - ci/jobs/code_coverage_frontend - - store_test_results: - path: test-results - - upload_coverage: - docker: - - image: circleci/circleci-cli:alpine - working_directory: ~/plugin - steps: - - attach_workspace: - at: . - - run: - name: Upload coverage results to Code Climate - command: | - ./ccbin/cc-test-reporter sum-coverage out/codeclimate.*.json -d -p 1 -o out/codeclimate.total.json - ./ccbin/cc-test-reporter upload-coverage -i out/codeclimate.total.json - - build_docs: - executor: default_exec - steps: - - checkout - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Build docs - command: | - ./node_modules/.bin/grafana-toolkit plugin:ci-docs - [ -d "dist" ] || circleci-agent step halt - - persist_to_workspace: - root: . - paths: - - dist - - build_frontend: - executor: default_exec - steps: - - checkout - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Build and test frontend - command: ./node_modules/.bin/grafana-toolkit plugin:ci-build - - persist_to_workspace: - root: . - paths: - - dist - - coverage - - build_backend: - executor: default_exec - steps: - - checkout - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Exit if no backend - command: | - [ -f "Magefile.go" ] || circleci-agent step halt - - run: - name: Build backend - command: mage -v buildAll - - run: - name: Test backend - command: | - mage -v lint - mage -v coverage - - persist_to_workspace: - root: . - paths: - - dist - - package: - executor: default_exec - steps: - - checkout - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - attach_workspace: - at: . - - run: - name: Move results to ci folder - command: ./node_modules/.bin/grafana-toolkit plugin:ci-build --finish - - run: - name: Package distribution - command: | - ./node_modules/.bin/grafana-toolkit plugin:ci-package - - persist_to_workspace: - root: . - paths: - - ci/jobs/package - - ci/packages - - ci/dist - - ci/grafana-test-env - - store_artifacts: - path: ci - - report: - executor: default_exec - steps: - - checkout - - attach_workspace: - at: . - - restore_cache: - name: restore node_modules - keys: - - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} - - run: - name: Toolkit report - command: | - ./node_modules/.bin/grafana-toolkit plugin:ci-report - - store_artifacts: - path: ci diff --git a/.config/.eslintrc b/.config/.eslintrc new file mode 100644 index 0000000..15ae260 --- /dev/null +++ b/.config/.eslintrc @@ -0,0 +1,13 @@ +/* + * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ + * + * In order to extend the configuration follow the steps in + * https://grafana.com/developers/plugin-tools/create-a-plugin/extend-a-plugin/extend-configurations#extend-the-eslint-config + */ + { + "extends": ["@grafana/eslint-config"], + "root": true, + "rules": { + "react/prop-types": "off" + } +} diff --git a/.config/.prettierrc.js b/.config/.prettierrc.js new file mode 100644 index 0000000..66a76ec --- /dev/null +++ b/.config/.prettierrc.js @@ -0,0 +1,16 @@ +/* + * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ + * + * In order to extend the configuration follow the steps in .config/README.md + */ + +module.exports = { + "endOfLine": "auto", + "printWidth": 120, + "trailingComma": "es5", + "semi": true, + "jsxSingleQuote": false, + "singleQuote": true, + "useTabs": false, + "tabWidth": 2 +}; \ No newline at end of file diff --git a/.config/Dockerfile b/.config/Dockerfile new file mode 100644 index 0000000..35d89bd --- /dev/null +++ b/.config/Dockerfile @@ -0,0 +1,16 @@ +ARG grafana_version=latest +ARG grafana_image=grafana-enterprise + +FROM grafana/${grafana_image}:${grafana_version} + +# Make it as simple as possible to access the grafana instance for development purposes +# Do NOT enable these settings in a public facing / production grafana instance +ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" +ENV GF_AUTH_ANONYMOUS_ENABLED "true" +ENV GF_AUTH_BASIC_ENABLED "false" +# Set development mode so plugins can be loaded without the need to sign +ENV GF_DEFAULT_APP_MODE "development" + +# Inject livereload script into grafana index.html +USER root +RUN sed -i 's/<\/body><\/html>/