Skip to content

Commit a56ecb6

Browse files
authored
chore: Switch from Travis to CircleCI (#473)
1 parent 725bf5b commit a56ecb6

File tree

3 files changed

+178
-15
lines changed

3 files changed

+178
-15
lines changed

.circleci/config.yml

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
version: 2.1
2+
3+
orbs:
4+
coveralls: coveralls/[email protected]
5+
puppeteer: threetreeslight/[email protected]
6+
7+
defaults: &defaults
8+
working_directory: ~/repo
9+
docker:
10+
- image: circleci/node:latest-browsers
11+
12+
jobs:
13+
checkout_code:
14+
<<: *defaults
15+
steps:
16+
- checkout
17+
- attach_workspace:
18+
at: ~/repo
19+
- restore_cache:
20+
keys:
21+
- v1-dependencies-{{ checksum "package.json" }}
22+
- v1-dependencies-
23+
- puppeteer/install
24+
- run: npm install
25+
- save_cache:
26+
paths:
27+
- node_modules
28+
key: v1-dependencies-{{ checksum "package.json" }}
29+
- persist_to_workspace:
30+
root: ~/repo
31+
paths: .
32+
33+
test_and_report:
34+
<<: *defaults
35+
steps:
36+
- attach_workspace:
37+
at: ~/repo
38+
- run: npm install
39+
- run: npm rebuild
40+
- run:
41+
name: Install codecov
42+
command: npm install --save-dev codecov
43+
- run:
44+
name: Tests && Codecov Report
45+
command: npm run test
46+
- coveralls/upload
47+
- store_artifacts:
48+
path: ./coverage/
49+
prefix: tests
50+
- store_artifacts:
51+
path: coverage
52+
prefix: coverage
53+
- store_test_results:
54+
path: ./coverage/
55+
56+
build:
57+
<<: *defaults
58+
steps:
59+
- attach_workspace:
60+
at: ~/repo
61+
- run: npm install
62+
- run: npm rebuild
63+
- run:
64+
name: Build our app
65+
command: npm run build
66+
- persist_to_workspace:
67+
root: ~/repo
68+
paths: .
69+
70+
publish_npm:
71+
<<: *defaults
72+
steps:
73+
- attach_workspace:
74+
at: ~/repo
75+
- run: npm install
76+
- run:
77+
name: Avoid hosts unknown for github
78+
command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
79+
- run:
80+
name: Publish using Semantic Release
81+
command: npx semantic-release
82+
- persist_to_workspace:
83+
root: ~/repo
84+
paths: .
85+
86+
publish_docs:
87+
working_directory: ~/repo
88+
docker:
89+
- image: circleci/ruby:2.6.0-node
90+
environment:
91+
BUNDLE_PATH: ~/repo/vendor/bundle
92+
steps:
93+
- attach_workspace:
94+
at: ~/repo
95+
- run:
96+
name: Avoid hosts unknown for github
97+
command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
98+
- run: npm install
99+
- run: sudo npm install gitbook-cli -g
100+
- run:
101+
name: Do Magic
102+
command: sh ~/repo/build/update-docs.sh
103+
104+
workflows:
105+
version: 2
106+
107+
###
108+
# PULL REQUESTS
109+
###
110+
test_build:
111+
jobs:
112+
- checkout_code:
113+
filters:
114+
branches:
115+
ignore:
116+
- master
117+
- feature/*
118+
- hotfix/*
119+
- test_and_report:
120+
requires:
121+
- checkout_code
122+
- build:
123+
requires:
124+
- checkout_code
125+
126+
###
127+
# MERGE: MASTER
128+
###
129+
test_build_publish:
130+
jobs:
131+
- checkout_code:
132+
filters:
133+
branches:
134+
only: master
135+
- test_and_report:
136+
requires:
137+
- checkout_code
138+
- build:
139+
requires:
140+
- checkout_code
141+
- publish_npm:
142+
requires:
143+
- checkout_code
144+
- test_and_report
145+
- build
146+
# - build_examples:
147+
# requires:
148+
# - publish_npm
149+
- publish_docs:
150+
requires:
151+
- publish_npm

.circleci/version.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# reads version from package.json and sets prelease equal to Circle CI build number
2+
if [ $CI ] && [ $CIRCLE_BUILD_NUM ]
3+
then
4+
PACKAGE_VERSION=$(cat package.json \
5+
| grep version \
6+
| head -1 \
7+
| awk -F: '{ print $2 }' \
8+
| sed 's/[",]//g' \
9+
| tr -d '[[:space:]]')
10+
11+
NEW_PACKAGE_VERSION=$(echo $PACKAGE_VERSION | sed -e "s/^\([0-9]*\.[0-9]*\.[0-9]*\-[a-z]*\).[0-9]*$/\1.$CIRCLE_BUILD_NUM/")
12+
echo "Found package version: $PACKAGE_VERSION"
13+
echo "Setting version to: $NEW_PACKAGE_VERSION"
14+
# uses npm-version to set version in package.json
15+
# see https://docs.npmjs.com/cli/version
16+
npm version $NEW_PACKAGE_VERSION --no-git-tag-version
17+
#
18+
git config credential.helper 'cache --timeout=120'
19+
git config user.email "[email protected]"
20+
git config user.name "Daniel Brown"
21+
git add .
22+
git commit --allow-empty -m "Version Bump"
23+
# Push quietly to prevent showing the token in log
24+
# git push -q https://${GITHUB_TOKEN}@github.com/cornerstonejs/cornerstoneTools.git vNext
25+
else
26+
echo "Don't forget to update the build version!"
27+
fi

.travis.yml

-15
This file was deleted.

0 commit comments

Comments
 (0)