1- version : 2
2- jobs :
3- build :
4- working_directory : ~/phovea
1+ version : 2.1
2+
3+ executors :
4+ python-executor :
5+ working_directory : ~/phovea-python
56 docker :
67 - image : circleci/python:3.7-buster-node-browsers # for node version see Dockerfile on https://hub.docker.com/r/circleci/python
8+ node-executor :
9+ working_directory : ~/phovea-web
10+ docker :
11+ - image : circleci/node:12.13-buster-browsers
12+
13+ jobs :
14+ python-build :
15+ executor : python-executor
716 steps :
817 - checkout
918 - run :
2029 name : Install Docker packages from docker_packages.txt
2130 command : |
2231 (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs sudo apt-get install -y))
23- - restore_cache :
24- key : deps2-{{ .Branch }}-{{ checksum "package.json" }}
25- - run :
26- name : Install npm dependencies
27- command : npm install
28- - run :
29- name : Remove npm dependencies installed from git repositories (avoid caching of old commits)
30- command : |
31- (grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf
32- - save_cache :
33- key : deps2-{{ .Branch }}-{{ checksum "package.json" }}
34- paths :
35- - ./node_modules
36- - run :
37- name : Install npm dependencies from git repositories (always get latest commit)
38- command : npm install
39- - run :
40- name : Show installed npm dependencies
41- command : npm list --depth=1 || true
4232 - restore_cache :
4333 key : deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }}
4434 - run :
@@ -60,16 +50,96 @@ jobs:
6050 - run :
6151 name : Show installed pip packages
6252 command : pip list || true
53+ - run :
54+ name : Remove all from dist folder
55+ command : |
56+ rm -rf dist && mkdir dist
6357 - run :
6458 name : Build
6559 command : |
6660 . ~/venv/bin/activate
67- npm run dist
61+ npm run dist:python
6862 - store_artifacts :
6963 path : dist
70- destination : dist
64+ destination : dist-python
65+ - persist_to_workspace :
66+ root : ~/.
67+ paths : phovea-python
68+ python-publish :
69+ executor : python-executor
70+ steps :
71+ - attach_workspace :
72+ at : ~/.
73+ - run : ls -a
74+ - run :
75+ name : Install twine
76+ command : |
77+ virtualenv ~/venv
78+ . ~/venv/bin/activate
79+ pip install twine
80+ - run :
81+ name : Authentication
82+ command : |
83+ echo -e "[pypi]" >> ~/.pypirc
84+ echo -e "repository = $PYPI_REPOSITORY" >> ~/.pypirc
85+ echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
86+ echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
87+ - run :
88+ name : Publish package
89+ command : |
90+ . ~/venv/bin/activate
91+ twine upload dist/*
92+ web-build :
93+ executor : node-executor
94+ steps :
95+ - checkout
96+ - run :
97+ name : Show Node.js and npm version
98+ command : |
99+ node -v
100+ npm -v
101+ - restore_cache :
102+ key : deps1-{{ .Branch }}-{{ checksum "package.json" }}
103+ - run :
104+ name : Install npm dependencies
105+ command : npm install
106+ - run :
107+ name : Remove npm dependencies installed from git repositories (avoid caching of old commits)
108+ command : |
109+ (grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf
110+ - save_cache :
111+ key : deps1-{{ .Branch }}-{{ checksum "package.json" }}
112+ paths : ./node_modules
113+ - run :
114+ name : Install npm dependencies from git repositories (always get latest commit)
115+ command : npm install
116+ - run :
117+ name : Show installed npm dependencies
118+ command : npm list --depth=1 || true
119+ - run :
120+ name : Build
121+ command : npm run dist:web
122+ - store_artifacts :
123+ path : dist
124+ destination : dist-web
125+ - persist_to_workspace :
126+ root : ~/.
127+ paths : phovea-web
128+ web-publish :
129+ executor : node-executor
130+ steps :
131+ - attach_workspace :
132+ at : ~/.
133+ - run : ls -a
134+ - run :
135+ name : Authentication
136+ command : |
137+ echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
138+ - run :
139+ name : Publish package
140+ command : npm publish
71141workflows :
72- version : 2
142+ version : 2.1
73143# build-nightly:
74144# triggers:
75145# - schedule:
@@ -79,18 +149,51 @@ workflows:
79149# only:
80150# - develop
81151# jobs:
82- # - build
83- build-branch :
152+ # - python-build
153+ # - web-build
154+ build-branches-only :
84155 jobs :
85- - build :
156+ - python- build :
86157 filters :
87158 tags :
88- ignore : /^v.*/
89- build-tag :
159+ ignore : /.*/
160+ - web-build :
161+ filters :
162+ tags :
163+ ignore : /.*/
164+ build-publish-tag :
90165 jobs :
91- - build :
166+ - python-build :
167+ filters :
168+ branches :
169+ ignore : /.*/
170+ tags :
171+ only : /^v.*/
172+ - web-build :
92173 filters :
93174 branches :
94175 ignore : /.*/
95176 tags :
96177 only : /^v.*/
178+ - python-publish :
179+ context :
180+ - org-public
181+ requires :
182+ - python-build
183+ - web-build
184+ filters :
185+ branches :
186+ ignore : /.*/
187+ tags :
188+ only : /^v.*/
189+ - web-publish :
190+ context :
191+ - org-public
192+ requires :
193+ - python-build
194+ - web-build
195+ filters :
196+ branches :
197+ ignore : /.*/
198+ tags :
199+ only : /^v.*/
0 commit comments