This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update version and packages * update circleci * add version dependency
- Loading branch information
Showing
5 changed files
with
483 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,97 +2,168 @@ version: 2 | |
|
||
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: ~/grafana-influxdb-flux-datasource | ||
docker: | ||
- image: circleci/node:10.15.3-stretch | ||
- image: circleci/node:10.16.3-stretch | ||
|
||
jobs: | ||
build: | ||
build_plugin: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Build | ||
command: | | ||
DATASOURCE_NAME=grafana-influxdb-flux-datasource | ||
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 ${DATASOURCE_NAME}/.git/**\* \ | ||
-x ${DATASOURCE_NAME}/node_modules/**\* \ | ||
-r /tmp/${DATASOURCE_NAME}-${VERSION}.zip \ | ||
${DATASOURCE_NAME} | ||
# create tar file | ||
echo "Creating TAR" | ||
tar \ | ||
--exclude .git \ | ||
--exclude ${DATASOURCE_NAME}/node_modules \ | ||
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \ | ||
${DATASOURCE_NAME} | ||
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar | ||
# create artifacts | ||
mkdir -p ~/${DATASOURCE_NAME}/artifacts | ||
mv /tmp/${DATASOURCE_NAME}-${VERSION}.zip ~/${DATASOURCE_NAME}/artifacts/ | ||
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_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: | ||
- artifacts | ||
- dist | ||
- store_artifacts: | ||
path: artifacts | ||
- store_artifacts: | ||
path: dist | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Install yarn | ||
command: | | ||
sudo npm install -g yarn --quiet | ||
yarn install --pure-lockfile | ||
- run: | ||
name: Run Toolkit Build | ||
command: npx grafana-toolkit plugin:ci-build | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ci | ||
|
||
test: | ||
build_docs: | ||
<<: *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 specs | ||
- store_artifacts: | ||
path: coverage | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Install yarn | ||
command: | | ||
sudo npm install -g yarn --quiet | ||
yarn install --pure-lockfile | ||
mkdir ci # Avoid error if not exists | ||
- run: | ||
name: Build Docs | ||
command: npx grafana-toolkit plugin:ci-docs | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: yarn-packages-{{ checksum "yarn.lock" }} | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ci | ||
|
||
package: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Package Distribution | ||
command: | | ||
ls -l ci | ||
ls -l ci/jobs | ||
ls -l ci/jobs/build_plugin | ||
ls -l ci/jobs/build_plugin/dist | ||
npx grafana-toolkit plugin:ci-package | ||
echo Build TAR | ||
DATASOURCE_NAME=grafana-influxdb-flux-datasource | ||
mkdir -p ci/jobs/build_tar/${DATASOURCE_NAME} | ||
cp -rp ci/jobs/build_plugin/dist/* ci/jobs/build_tar/${DATASOURCE_NAME} | ||
ls -al ci/jobs/build_tar | ||
ls -al ci/jobs/build_tar/${DATASOURCE_NAME} | ||
cd ci/jobs/build_tar | ||
ls -al | ||
sudo apt-get install jq | ||
VERSION=`cat ${DATASOURCE_NAME}/plugin.json|jq '.info.version'| sed s/\"//g` # create tar file | ||
echo "Creating TAR" | ||
tar \ | ||
-cvf /tmp/${DATASOURCE_NAME}-${VERSION}.tar \ | ||
${DATASOURCE_NAME} | ||
gzip /tmp/${DATASOURCE_NAME}-${VERSION}.tar | ||
mv /tmp/${DATASOURCE_NAME}-${VERSION}.tar.gz ~/${DATASOURCE_NAME}/ci/packages/ | ||
shasum \ | ||
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz > \ | ||
~/${DATASOURCE_NAME}/ci/packages/${DATASOURCE_NAME}-${VERSION}.tar.gz.sha1 | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ci | ||
- store_artifacts: | ||
path: ci/packages | ||
|
||
report: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Toolkit Report | ||
command: | | ||
# skipped - S3 permission issue | ||
# npx grafana-toolkit plugin:ci-report | ||
- store_artifacts: | ||
path: ci | ||
|
||
test_integration: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:10-browsers | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- restore_cache: | ||
keys: | ||
- yarn-packages-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: Setup Grafana (local install) | ||
command: | | ||
wget https://dl.grafana.com/oss/release/grafana_6.4.2_amd64.deb | ||
sudo apt-get install -y adduser libfontconfig1 | ||
sudo dpkg -i grafana_6.4.2_amd64.deb | ||
sudo apt-get install locate | ||
sudo updatedb | ||
sudo locate grafana | ||
sudo cat /etc/grafana/grafana.ini | ||
sudo echo ------------------------ | ||
sudo cp ci/grafana-test-env/custom.ini /usr/share/grafana/conf/custom.ini | ||
sudo cp ci/grafana-test-env/custom.ini /etc/grafana/grafana.ini | ||
sudo service grafana-server start | ||
sudo grafana-cli --version | ||
- run: | ||
name: Run e2e tests | ||
command: | | ||
npx grafana-toolkit plugin:ci-test | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ci/jobs/test_integration | ||
- store_test_results: | ||
path: ci/jobs/test_integration | ||
- store_artifacts: | ||
path: ci/jobs/test_integration | ||
|
||
publish-github-release: | ||
working_directory: ~/grafana-influxdb-flux-datasource | ||
docker: | ||
- image: cibuilds/github:0.12 | ||
- image: cibuilds/github:0.13 | ||
steps: | ||
- checkout | ||
- add_ssh_keys: | ||
|
@@ -104,9 +175,15 @@ jobs: | |
name: "Publish Release on GitHub" | ||
command: | | ||
DATASOURCE_NAME=grafana-influxdb-flux-datasource | ||
# copy ci dist | ||
cp -r ci/jobs/build_plugin/dist . | ||
# copy ci artifacts | ||
mkdir -p artifacts | ||
cp -r ci/packages/* artifacts | ||
# | ||
apk add --update --no-cache jq | ||
RELEASE_NOTES=`awk 'BEGIN {FS="##"; RS=""} FNR==3 {print; exit}' CHANGELOG.md` | ||
VERSION=`cat src/plugin.json|jq '.info.version'| sed s/\"//g` | ||
VERSION=`cat dist/plugin.json|jq '.info.version'| sed s/\"//g` | ||
ls -al | ||
ls -al ./artifacts | ||
git config user.email "[email protected]" | ||
|
@@ -131,30 +208,27 @@ jobs: | |
workflows: | ||
version: 2 | ||
build-master: | ||
plugin_workflow: | ||
jobs: | ||
- build: | ||
filters: *filter-only-master | ||
- test: | ||
- build_plugin | ||
- build_docs: | ||
requires: | ||
- build | ||
filters: *filter-only-master | ||
- build_plugin | ||
- package: | ||
requires: | ||
- build_docs | ||
- test_integration: | ||
requires: | ||
- package | ||
- report: | ||
requires: | ||
- test_integration | ||
- approve-release: | ||
type: approval | ||
requires: | ||
- build | ||
- test | ||
- report | ||
filters: *filter-only-master | ||
- publish-github-release: | ||
requires: | ||
- approve-release | ||
filters: *filter-only-master | ||
|
||
build-branches-and-prs: | ||
jobs: | ||
- build: | ||
filters: *filter-not-release-or-master | ||
- test: | ||
requires: | ||
- build | ||
filters: *filter-not-release-or-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.