forked from bids-standard/bids-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
190 lines (184 loc) · 6.37 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
version: 2
jobs:
build_docs:
docker:
- image: circleci/python:3.6.6
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages
- restore_cache: # ensure this step occurs *before* installing dependencies
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
sudo pip install pip==18.0
sudo pip install pipenv==2018.7.1
pipenv install
- save_cache:
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- ".venv"
- "/usr/local/bin"
- "/usr/local/lib/python3.6/site-packages"
- run:
name: generate docs
command: pipenv run mkdocs build --clean --strict --verbose
- store_artifacts:
path: site
- persist_to_workspace:
root: .
paths: site
linkchecker:
docker:
- image: yarikoptic/linkchecker:9.4.0.anchorfix1-1
steps:
- attach_workspace:
at: ~/build
- run:
command: |
chmod a+rX -R ~
linkchecker -t 1 ~/build/site/
# check external separately by pointing to all *html so no
# failures for local file:/// -- yoh found no better way,
linkchecker -t 1 --check-extern --ignore-url 'file:///.*' --ignore-url https://fonts.gstatic.com ~/build/site/*html ~/build/site/*/*.html
build_docs_pdf:
working_directory: ~/bids-specification/pdf_build_src
docker:
- image: danteev/texlive:TL2017
steps:
- checkout:
path: ~/bids-specification
- run:
name: generate pdf version docs
command: sh build_pdf.sh
- store_artifacts:
path: bids-spec.pdf
- run:
name: remove pdf version from repo
command: rm bids-spec.pdf
# Auto changelog collector
github-changelog-generator:
working_directory: ~/build
docker:
- image: ferrarimarco/github-changelog-generator:1.14.3
steps:
- setup_remote_docker:
version: 17.11.0-ce
- checkout
- run:
name: Build changelog
working_directory: ~/build
command: |
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
github_changelog_generator --user bids-standard --project bids-specification --token ${CHANGE_TOKEN} --output ~/build/CHANGES.md --base ~/build/src/pregh-changes.md --header-label "# Changelog" --no-issues --no-issues-wo-labels --no-filter-by-milestone --no-compare-link --pr-label ""
cat ~/build/CHANGES.md
mv ~/build/CHANGES.md ~/build/src/CHANGES.md
else
echo "Commit or Release, do nothing"
fi
- persist_to_workspace:
root: .
paths: src
# Clear remark test
remark:
working_directory: ~
docker:
- image: node:latest
steps:
- checkout
- attach_workspace:
at: ~/build
- run:
name: update-npm
command: |
cd ~
npm install npm@latest
- run:
name: get remark
command: |
cd ~
npm install remark remark-cli
- run:
name: get remark styles
command: |
cd ~
cat ~/project/npm-requirements.txt | xargs npm install
- run: # remark the auto generated changes.md
name: remark on autogenerated CHANGES.md
command: |
cd ~/project
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
mkdir ~/project/src/tmp
cat ~/build/src/CHANGES.md
cp ~/build/src/CHANGES.md ~/project/src/CHANGES.md
~/node_modules/.bin/remark ~/project/src/CHANGES.md -o ~/project/src/tmp/CHANGES.md
~/node_modules/.bin/remark ~/project/src/tmp/CHANGES.md --frail
else
echo "Commit or Release, do nothing"
mkdir ~/project/src/tmp
touch ~/project/src/tmp/empty.txt
fi
- persist_to_workspace:
root: ~/project/src
paths: tmp
# Push built changelog to repo
Changelog-bot:
working_directory: ~/build
docker:
- image: circleci/openjdk:8-jdk
steps:
- setup_remote_docker:
version: 17.11.0-ce
- checkout
- attach_workspace:
at: ~/build
- deploy:
name: Changelog deployment
working_directory: ~/build
command: |
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
mv ~/build/tmp/CHANGES.md ~/build/src/CHANGES.md
merge_messsge=$(git log -1 | grep Merge | grep "pull")
PR_number=$(echo $merge_messsge | cut -d ' ' -f 4)
git config credential.helper 'cache --timeout=120'
git config user.email "[email protected]"
git config user.name "bids-maintenance"
git add ~/build/src/CHANGES.md
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master
else
echo "Commit or Release, do nothing"
fi
workflows:
version: 2
search_build:
jobs:
- build_docs
- linkchecker:
requires:
- build_docs
- github-changelog-generator:
filters:
branches:
only: master
- remark:
requires:
- github-changelog-generator
filters:
branches:
only: master
- Changelog-bot:
requires:
- remark
filters:
branches:
only: master
# Ensure that build_docs_pdf always runs last, so that we can use the CircleCI API link for the "latest" artifact
# https://circleci.com/api/v1.1/project/github/bids-standard/bids-specification/latest/artifacts/0/bids-spec.pdf?branch=master
- build_docs_pdf:
requires:
- build_docs
- linkchecker
- github-changelog-generator
- remark
- Changelog-bot