forked from marcocastellaro/bids-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
163 lines (161 loc) · 5.24 KB
/
circle.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
version: 2
jobs:
test:
docker:
- image: node:8.11.3-alpine
steps:
- checkout
- run: apk --no-cache add ca-certificates
- restore_cache:
keys:
- npm-deps-{{ checksum "package.json" }}
- run: yarn
- save_cache:
key: npm-deps-{{ checksum "package.json" }}
paths: node_modules
- run:
name: Eslint
command: yarn lint
- run:
name: Mocha tests
command: yarn coverage
- run:
name: Upload to codecov
command: yarn codecov
- run:
name: Smoke tests
command: bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders && bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders --json
githubPagesTest:
docker:
- image: node:8.11.3-alpine
steps:
- checkout
- run: apk --no-cache add ca-certificates
- restore_cache:
keys:
- npm-deps-{{ checksum "package.json" }}
- run: apk --no-cache add rsync git python build-base openssh
- run:
name: Install bids-validator and bids-validator-web dependencies
command: yarn
- run:
name: Build and export web-validator
command: yarn web-export && rsync -av ./bids-validator-web/out/ ~/web_version
- store_artifacts:
path: ~/web_version
pypi_precheck:
docker:
- image: alpine:3.8
steps:
- checkout
- run:
name: Set up environment
command: |
apk --no-cache add ca-certificates git build-base
- run:
name: Install Python 3 and update setuptools
command: |
apk --no-cache add python3 python3-dev py3-cffi
python3 -m pip install --upgrade pip setuptools wheel twine readme_renderer[md]
- run:
name: Check build and readme rendering
command: |
cd bids-validator && python3 setup.py sdist bdist_wheel
twine check dist/*
- run:
name: Check sdist installation
command: |
cd bids-validator
python3 -m pip install -U virtualenv
virtualenv venv
source venv/bin/activate
python --version
pip install -U pip setuptools>=27.0 wheel
pip install dist/*.tar.gz
deployment:
docker:
- image: node:8.11.3-alpine
steps:
- add_ssh_keys:
fingerprints:
- '44:93:5a:f4:2b:2d:c1:8a:f2:8e:8b:e9:27:5f:93:25'
- checkout
- run: apk --no-cache add ca-certificates
- run: apk --no-cache add git python build-base openssh
- run:
name: Install Python 3 and update setuptools
command: |
apk --no-cache add python3 python3-dev py3-cffi
python3 -m pip install --upgrade pip setuptools wheel twine
- run: git checkout -f $CIRCLE_TAG
- run: cd bids-validator && python3 setup.py sdist bdist_wheel
# Publish to NPM
- run: yarn
- run: ./node_modules/.bin/npm-cli-login -u $NPM_USERNAME -p $NPM_PASSWORD -e $NPM_EMAIL
# Set the version number
- run: cd bids-validator && sed -i -E "s/0.0.0/$CIRCLE_TAG/" package.json
- run: cd bids-validator && npm publish
# Publish to PyPI
- run: cd bids-validator && twine upload dist/*
# Update gh-pages demo site
- run: git config --global user.email circleci@circleci
- run: git config --global user.name CircleCI
- run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- run:
name: Create new gh-pages branch without history
command: git checkout --orphan gh-pages
- run:
name: Install web demo dependencies
command: yarn
- run:
name: Build and export next project
command: yarn web-export
- run:
name: Clean and remove bids-validator files
command: git reset . && git clean --force -d --exclude bids-validator-web/out
- run:
name: Move build into root directory
command: mv bids-validator-web/out/* .
- run:
name: Remove files not related to build
command: rm -r bids-validator bids-validator-web node_modules
- run:
name: Create a nojekyll file (gh-pages specific)
command: touch .nojekyll
- run: git status
- run:
name: Commit updates
command: git add . && git commit --allow-empty --no-verify -m 'Circle CI - Generate validator demo with version $CIRCLE_TAG'
- run: git push origin gh-pages -f
workflows:
version: 2
build-deploy:
jobs:
- test:
filters:
branches:
only: /.*/
tags:
only: /.*/
- githubPagesTest:
requires:
- test
filters:
branches:
only: /.*/
tags:
only: /.*/
- pypi_precheck:
filters:
tags:
only: /.*/
- deployment:
requires:
- test
- githubPagesTest
- pypi_precheck
filters:
branches:
ignore: /.*/
tags:
only: /.*/