forked from plotly/dash-sample-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
130 lines (125 loc) · 4.47 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
version: 2.0
jobs:
test_black:
docker:
- image: circleci/python:3.6-stretch-node-browsers
working_directory: ~/dash-sample-apps
steps:
- checkout
- run:
name: install black and flake8
command: |
sudo pip install black flake8
- run:
name: run black
command: |
black . --check
- run:
name: run flake8
command: |
flake8 --select=E265,E711,W291
deploy_to_playground:
docker:
- image: circleci/python:3.6-stretch
working_directory: ~/dash-sample-apps
steps:
- checkout
- run:
name: Add plotly remote
command: git remote add playground https://dash-playground.plotly.host/GIT/$CIRCLE_BRANCH
- run:
name: Create helper-script
command: printf '#!/bin/bash\necho username=$PLAYGROUND_DEPLOY_USERNAME\necho password=$PLAYGROUND_DEPLOY_PASSWORD' >> /home/circleci/helper-script.sh
- run:
name: Set up git config
command: |
git config --global credential.helper "/bin/bash /home/circleci/helper-script.sh"
git config --global user.email '<>' # Leave email blank
git config --global user.name "Circle MonoRepo Automatic Deployer"
- run:
name: Install curl
command: |
sudo apt update
sudo apt install -y -qq curl
- run:
name: Install dds-client
command: |
curl -sSL -o dds-client.tgz https://github.com/plotly/dds-client/releases/download/v0.3.0/dds-client_0.3.0_linux_x86_64.tgz
mkdir $HOME/bin
tar xzf dds-client.tgz -C $HOME/bin
chmod +x $HOME/bin/dds-client
- run:
name: Deploy
command: |
APPS_MODIFIED=$(git diff origin/master origin/$CIRCLE_BRANCH --dirstat=files,1 apps/ | awk '{ split($2,a,"/"); if (length(a[2]) != 0) { print a[2]} } ' | sort -u)
if [ -z "$APPS_MODIFIED" ]
then
echo "No app change detected. Skipping the deploy.."
exit 0
fi
for APP in $APPS_MODIFIED
do
CREATE_APP=true DASH_ENTERPRISE_URL="$DASH_PLAYGROUND_ENTERPRISE_URL" DASH_ENTERPRISE_API_KEY="$DASH_PLAYGROUND_ENTERPRISE_API_KEY" PATH="$HOME/bin:$PATH" ./deploy "$APP"
done
deploy_to_gallery:
docker:
- image: circleci/python:3.6-stretch
working_directory: ~/dash-sample-apps
steps:
- checkout
- run:
name: Add plotly remote
command: git remote add gallery https://dash-playground.plotly.host/GIT/$CIRCLE_BRANCH
- run:
name: Create helper-script
command: printf '#!/bin/bash\necho username=$GALLERY_DEPLOY_USERNAME\necho password=$GALLERY_DEPLOY_PASSWORD' >> /home/circleci/helper-script.sh
- run:
name: Set up git config
command: |
git config --global credential.helper "/bin/bash /home/circleci/helper-script.sh"
git config --global user.email '<>' # Leave email blank
git config --global user.name "Circle MonoRepo Automatic Deployer"
- run:
name: Install curl
command: |
sudo apt update
sudo apt install -y -qq curl
- run:
name: Install dds-client
command: |
curl -sSL -o dds-client.tgz https://github.com/plotly/dds-client/releases/download/v0.3.0/dds-client_0.3.0_linux_x86_64.tgz
mkdir $HOME/bin
tar xzf dds-client.tgz -C $HOME/bin
chmod +x $HOME/bin/dds-client
- run:
name: Deploy
command: |
APPS_MODIFIED=$(ls apps | grep dash- | sort -u)
if [ -z "$APPS_MODIFIED" ]
then
echo "No app change detected. Skipping the deploy.."
exit 0
fi
for APP in $APPS_MODIFIED
do
DASH_ENTERPRISE_URL="$DASH_GALLERY_ENTERPRISE_URL" DASH_ENTERPRISE_API_KEY="$DASH_GALLERY_ENTERPRISE_API_KEY" PATH="$HOME/bin:$PATH" ./deploy "$APP"
done
workflows:
version: 2
test-and-deploy:
jobs:
- test_black
- deploy_to_playground:
requires:
- test_black
filters:
branches:
ignore:
- master
- deploy_to_gallery:
requires:
- test_black
filters:
branches:
only:
- master