Skip to content

Commit

Permalink
20190724 webpack conversions (#61)
Browse files Browse the repository at this point in the history
* more conversions

* fix for kbn warnings

* bugfixes

* update circleci

* cleanup
  • Loading branch information
briangann authored Jul 26, 2019
1 parent edf09c8 commit 265bf7f
Show file tree
Hide file tree
Showing 873 changed files with 14,670 additions and 237,636 deletions.
177 changes: 144 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,160 @@

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.12-stretch

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo
aliases:
# Workflow filters
- &filter-only-release
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
- &filter-not-release-or-master
tags:
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: master
- &filter-only-master
branches:
only: master

defaults: &defaults
working_directory: ~/briangann-datatable-panel
docker:
- image: circleci/node:10.15.3-stretch

jobs:
build:
<<: *defaults
steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Build
command: |
sudo npm install -g grunt-cli
sudo npm install -g jest
yarn install
grunt
PLUGIN_NAME=briangann-datatable-panel
yarn install --pure-lockfile --no-progress
yarn build
sudo apt-get install jq
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
# create zip file
cd ~
echo "Creating ZIP"
zip \
-x ${PLUGIN_NAME}/.git/**\* \
-x ${PLUGIN_NAME}/node_modules/**\* \
-r /tmp/${PLUGIN_NAME}-${VERSION}.zip \
${PLUGIN_NAME}
# create tar file
echo "Creating TAR"
tar \
--exclude .git \
--exclude ${PLUGIN_NAME}/node_modules \
-cvf /tmp/${PLUGIN_NAME}-${VERSION}.tar \
${PLUGIN_NAME}
gzip /tmp/${PLUGIN_NAME}-${VERSION}.tar
# create artifacts
mkdir -p ~/${PLUGIN_NAME}/artifacts
mv /tmp/${PLUGIN_NAME}-${VERSION}.zip ~/${PLUGIN_NAME}/artifacts/
mv /tmp/${PLUGIN_NAME}-${VERSION}.tar.gz ~/${PLUGIN_NAME}/artifacts/
no_output_timeout: 5m
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# ignore for now
#- store_artifacts:
# path: dist
- artifacts
- dist
- store_artifacts:
path: artifacts
- store_artifacts:
path: dist

test:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Test
command: |
yarn install --pure-lockfile --no-progress
sudo npm install -g jest
yarn test
- store_artifacts:
path: coverage

publish-github-release:
working_directory: ~/briangann-datatable-panel
docker:
- image: cibuilds/github:0.12
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "4f:f9:7a:21:16:c1:92:cb:bf:14:e0:72:a5:aa:36:07"
- attach_workspace:
at: .
- run:
name: "Publish Release on GitHub"
command: |
PLUGIN_NAME=briangann-datatable-panel
apk add --update --no-cache jq
RELEASE_NOTES=`awk 'BEGIN {FS="##"; RS=""} FNR==3 {print; exit}' CHANGELOG.md`
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g`
ls -al
ls -al ./artifacts
git config user.email "bkgann@gmail.com"
git config user.name "CircleCI Automation"
git checkout -b release-${VERSION}
git add --force dist/
git add artifacts/
git commit -m "automated release $VERSION [skip ci]"
git push -f origin release-${VERSION}
git tag -f v${VERSION}
git push -f origin v${VERSION}
ghr \
-t ${GITHUB_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-n "${PLUGIN_NAME} v${VERSION}" \
-b "${RELEASE_NOTES}" \
-delete \
v${VERSION} \
./artifacts/
workflows:
version: 2
build:
build-master:
jobs:
- build:
filters: *filter-only-master
- test:
requires:
- build
filters: *filter-only-master
- approve-release:
type: approval
requires:
- build
- test
filters: *filter-only-master
- publish-github-release:
requires:
- approve-release
filters: *filter-only-master

build-branches-and-prs:
jobs:
- build
- build:
filters: *filter-not-release-or-master
- test:
requires:
- build
filters: *filter-not-release-or-master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
bower_components
node_modules
package-lock.json
dist
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"),
};
Loading

0 comments on commit 265bf7f

Please sign in to comment.