@@ -2,63 +2,90 @@ version: 2
2
2
jobs :
3
3
build_docs :
4
4
docker :
5
- - image : circleci /python:3.8
5
+ - image : cimg /python:3.8
6
6
steps :
7
+ # checkout code to default ~/project
7
8
- checkout
8
9
- run :
9
10
name : install dependencies
10
11
command : |
12
+ python -m venv env
13
+ source env/bin/activate
11
14
python -m pip install --upgrade pip
12
15
pip install -r requirements.txt
16
+ pip install -e ~/project/tools/schemacode/
13
17
- run :
14
18
name : generate docs
15
- command : mkdocs build --clean --strict --verbose
19
+ command : |
20
+ source env/bin/activate
21
+ mkdocs build --clean --strict --verbose
16
22
- persist_to_workspace :
17
- root : .
23
+ # the mkdocs build outputs are in ~/project/site
24
+ root : ~/project
18
25
paths : site
26
+ - store_artifacts :
27
+ path : ~/project/site/
28
+ destination : dev_docs
19
29
20
30
linkchecker :
21
31
docker :
22
- - image : yarikoptic/linkchecker:9.4.0.anchorfix1-1
32
+ - image : cimg/python:3.8
23
33
steps :
34
+ # checkout code to default ~/project
35
+ - checkout
24
36
- attach_workspace :
25
- at : ~/build
37
+ # mkdocs build outputs will be in ~/project/site
38
+ at : ~/project
39
+ - run :
40
+ name : install linkchecker
41
+ command : |
42
+ python -m venv env
43
+ source env/bin/activate
44
+ python -m pip install --upgrade pip
45
+ python -m pip install linkchecker
26
46
- run :
27
47
name : check links
28
48
command : |
29
- if (! git log -1 --pretty=%b | grep REL:) ; then
30
- chmod a+rX -R ~
31
- linkchecker -t 1 ~/build/site/
32
- # check external separately by pointing to all *html so no
33
- # failures for local file:/// -- yoh found no better way,
34
- linkchecker -t 1 --check-extern \
35
- --ignore-url 'file:///.*' \
36
- --ignore-url https://fonts.gstatic.com \
37
- --ignore-url "https://github.com/bids-standard/bids-specification/(pull|tree)/.*" \
38
- --ignore-url "https://github.com/[^/]*" \
39
- ~/build/site/*html ~/build/site/*/*.html
49
+ source env/bin/activate
50
+ git status
51
+ if (! git log -1 --pretty=oneline | grep REL:) ; then
52
+ chmod a+rX -R ~
53
+ linkchecker -t 1 ~/project/site/
54
+ # check external separately by pointing to all *html so no
55
+ # failures for local file:/// -- yoh found no better way,
56
+ linkchecker -t 1 --check-extern \
57
+ --ignore-url 'file:///.*' \
58
+ --ignore-url 'https://fonts.gstatic.com' \
59
+ --ignore-url 'https://github.com/bids-standard/bids-specification/(pull|tree)/.*' \
60
+ --ignore-url 'https://github.com/[^/]*' \
61
+ --ignore-url 'https://doi.org/.*' \
62
+ --ignore-url 'https://bids-specification.readthedocs.io/en/stable/.*' \
63
+ ~/project/site/*html ~/project/site/*/*.html
40
64
else
41
- echo "Release PR - do nothing"
65
+ echo "Release PR - do nothing"
42
66
fi
43
67
44
68
build_docs_pdf :
45
- working_directory : ~/bids-specification/pdf_build_src
46
69
docker :
47
70
- image : danteev/texlive:latest
48
71
steps :
49
- - checkout :
50
- path : ~/bids-specification
72
+ # checkout code to default ~/project
73
+ - checkout
51
74
- run :
52
75
name : install dependencies
53
76
command : |
54
- python -m pip install --upgrade pip
55
- pip install -r ../requirements.txt
77
+ apt-get update && apt install -y python3-pip
78
+ python3 -m pip install --upgrade pip
79
+ python3 -m pip install -r ~/project/requirements.txt
56
80
- run :
57
81
name : install font that works with unicode emojis
58
82
command : apt-get update && apt-get install -y fonts-symbola
59
83
- run :
60
84
name : generate pdf version docs
61
- command : bash build_pdf.sh
85
+ command : |
86
+ cd ~/project/pdf_build_src
87
+ bash build_pdf.sh
88
+ mv ~/project/pdf_build_src/bids-spec.pdf ~/project/bids-spec.pdf
62
89
- store_artifacts :
63
90
path : bids-spec.pdf
64
91
@@ -69,84 +96,94 @@ jobs:
69
96
steps :
70
97
- setup_remote_docker :
71
98
version : 18.06.0-ce
99
+ # checkout code to default ~/project
72
100
- checkout
73
101
- run :
74
102
name : Build changelog
75
- working_directory : ~/build
103
+ # $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
76
104
command : |
105
+ mkdir ~/changelog_build
106
+ git status
77
107
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
78
108
github_changelog_generator \
79
109
--user bids-standard \
80
110
--project bids-specification \
81
111
--token ${CHANGE_TOKEN} \
82
- --output ~/build /CHANGES.md \
83
- --base ~/build /src/pregh-changes.md \
112
+ --output ~/changelog_build /CHANGES.md \
113
+ --base ~/project /src/pregh-changes.md \
84
114
--header-label "# Changelog" \
85
115
--no-issues \
86
116
--no-issues-wo-labels \
87
117
--no-filter-by-milestone \
88
118
--no-compare-link \
89
119
--pr-label "" \
90
120
--release-branch master
91
- cat ~/build/CHANGES.md
92
- mv ~/build/CHANGES.md ~/build/src/CHANGES.md
121
+ cat ~/changelog_build/CHANGES.md
93
122
else
94
123
echo "Commit or Release, do nothing"
95
124
fi
96
125
- persist_to_workspace :
97
- root : .
98
- paths : src
126
+ # raw generated changelog in ~/changelog_build/CHANGES.md
127
+ root : ~/.
128
+ paths : changelog_build
99
129
100
130
# Run remark on the auto generated changes.md file
101
131
remark :
102
132
docker :
103
- - image : node:latest
133
+ - image : cimg/ node:lts
104
134
steps :
135
+ # checkout code to default ~/project
105
136
- checkout
106
137
- attach_workspace :
107
- at : ~/build
138
+ # the freshly built CHANGES.md will be in ~/changelog_build/CHANGES.md
139
+ at : ~/.
108
140
- run :
109
141
name : install remark and extensions
110
142
command : npm install `cat npm-requirements.txt`
111
143
- run :
112
144
name : remark on autogenerated CHANGES.md
145
+ # format changelog, then use sed to change * to -, then lint changelog
113
146
command : |
114
- mkdir ~/project/src/tmp
147
+ git status
115
148
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
116
- cat ~/build/src/CHANGES.md
117
- cp ~/build/src/CHANGES.md ~/project/src/tmp/CHANGES.md
118
- npx remark ~/project/src/tmp/CHANGES.md --frail --rc-path .remarkrc
149
+ head -n 100 ~/changelog_build/CHANGES.md
150
+ npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
151
+ head -n 100 ~/changelog_build/CHANGES.md
152
+ sed -i 's/* /- /' ~/changelog_build/CHANGES.md
153
+ head -n 100 ~/changelog_build/CHANGES.md
154
+ npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
119
155
else
120
156
echo "Commit or Release, do nothing"
121
- touch ~/project/src/tmp/empty.txt
122
157
fi
123
158
- persist_to_workspace :
124
- root : ~/project/src
125
- paths : tmp
159
+ # fixed+linted changelog in ~/changelog_build/CHANGES.md
160
+ root : ~/.
161
+ paths : changelog_build
126
162
127
163
# Push built changelog to repo
128
164
Changelog-bot :
129
- working_directory : ~/build
130
165
docker :
131
- - image : circleci/openjdk:8-jdk
166
+ - image : cimg/base:stable
132
167
steps :
133
168
- setup_remote_docker :
134
169
version : 17.11.0-ce
170
+ # checkout code to default ~/project
135
171
- checkout
136
172
- attach_workspace :
137
- at : ~/build
173
+ # fixed+linted changelog in ~/changelog_build/CHANGES.md
174
+ at : ~/.
138
175
- deploy :
139
176
name : Changelog deployment
140
- working_directory : ~/build
177
+ # $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
141
178
command : |
142
179
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
143
- mv ~/build/tmp/ CHANGES.md ~/build /src/CHANGES.md
180
+ mv ~/changelog_build/ CHANGES.md ~/project /src/CHANGES.md
144
181
merge_message=$(git log -1 | grep Merge | grep "pull")
145
182
PR_number=$(echo $merge_message | cut -d ' ' -f 4)
146
183
git config credential.helper 'cache --timeout=120'
147
184
git config user.email "[email protected] "
148
185
git config user.name "bids-maintenance"
149
- git add ~/build /src/CHANGES.md
186
+ git add ~/project /src/CHANGES.md
150
187
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
151
188
git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master
152
189
else
@@ -177,12 +214,4 @@ workflows:
177
214
filters :
178
215
branches :
179
216
only : master
180
- # Ensure that build_docs_pdf always runs last, so that we can use the CircleCI API link for the "latest" artifact
181
- # https://circleci.com/api/v1.1/project/github/bids-standard/bids-specification/latest/artifacts/0/bids-spec.pdf?branch=master
182
- - build_docs_pdf :
183
- requires :
184
- - build_docs
185
- - linkchecker
186
- - github-changelog-generator
187
- - remark
188
- - Changelog-bot
217
+ - build_docs_pdf
0 commit comments