Skip to content

Commit c79dd65

Browse files
committed
fix circleci workflow
1 parent 9c35577 commit c79dd65

File tree

1 file changed

+53
-39
lines changed

1 file changed

+53
-39
lines changed

.circleci/config.yml

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jobs:
44
docker:
55
- image: circleci/python:3.8
66
steps:
7+
# checkout code to default ~/project
78
- checkout
89
- run:
910
name: install dependencies
@@ -14,53 +15,56 @@ jobs:
1415
name: generate docs
1516
command: mkdocs build --clean --strict --verbose
1617
- persist_to_workspace:
17-
root: .
18+
# the mkdocs build outputs are in ~/project/site
19+
root: ~/project
1820
paths: site
1921

2022
linkchecker:
2123
docker:
2224
- image: yarikoptic/linkchecker:9.4.0.anchorfix1-1
2325
steps:
2426
- attach_workspace:
25-
at: ~/build
27+
# mkdocs build outputs will be in ~/project/site
28+
at: ~/project
2629
- run:
2730
name: check links
2831
command: |
2932
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
33+
chmod a+rX -R ~
34+
linkchecker -t 1 ~/project/site/
35+
# check external separately by pointing to all *html so no
36+
# failures for local file:/// -- yoh found no better way,
37+
linkchecker -t 1 --check-extern \
38+
--ignore-url 'file:///.*' \
39+
--ignore-url https://fonts.gstatic.com \
40+
--ignore-url "https://github.com/bids-standard/bids-specification/(pull|tree)/.*" \
41+
--ignore-url "https://github.com/[^/]*" \
42+
~/project/site/*html ~/project/site/*/*.html
4043
else
41-
echo "Release PR - do nothing"
44+
echo "Release PR - do nothing"
4245
fi
4346
4447
build_docs_pdf:
45-
working_directory: ~/bids-specification/pdf_build_src
4648
docker:
4749
- image: danteev/texlive:latest
4850
steps:
49-
- checkout:
50-
path: ~/bids-specification
51+
# checkout code to default ~/project
52+
- checkout
5153
- run:
5254
name: install dependencies
5355
command: |
5456
python -m pip install --upgrade pip
55-
pip install -r ../requirements.txt
57+
pip install -r ~/project/requirements.txt
5658
- run:
5759
name: install font that works with unicode emojis
5860
command: apt-get update && apt-get install -y fonts-symbola
5961
- run:
6062
name: generate pdf version docs
61-
command: bash build_pdf.sh
63+
command: |
64+
cd ~/project/pdf_build_src
65+
bash build_pdf.sh
6266
- store_artifacts:
63-
path: bids-spec.pdf
67+
path: ~/project/pdf_build_src/bids-spec.pdf
6468

6569
# Auto changelog collector
6670
github-changelog-generator:
@@ -69,84 +73,94 @@ jobs:
6973
steps:
7074
- setup_remote_docker:
7175
version: 18.06.0-ce
76+
# checkout code to default ~/project
7277
- checkout
7378
- run:
7479
name: Build changelog
75-
working_directory: ~/build
80+
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
7681
command: |
82+
mkdir ~/changelog_build
83+
git status
7784
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
7885
github_changelog_generator \
7986
--user bids-standard \
8087
--project bids-specification \
8188
--token ${CHANGE_TOKEN} \
82-
--output ~/build/CHANGES.md \
83-
--base ~/build/src/pregh-changes.md \
89+
--output ~/changelog_build/CHANGES.md \
90+
--base ~/project/src/pregh-changes.md \
8491
--header-label "# Changelog" \
8592
--no-issues \
8693
--no-issues-wo-labels \
8794
--no-filter-by-milestone \
8895
--no-compare-link \
8996
--pr-label "" \
9097
--release-branch master
91-
cat ~/build/CHANGES.md
92-
mv ~/build/CHANGES.md ~/build/src/CHANGES.md
98+
cat ~/changelog_build/CHANGES.md
9399
else
94100
echo "Commit or Release, do nothing"
95101
fi
96102
- persist_to_workspace:
97-
root: .
98-
paths: src
103+
# raw generated changelog in ~/changelog_build/CHANGES.md
104+
root: ~/.
105+
paths: changelog_build
99106

100107
# Run remark on the auto generated changes.md file
101108
remark:
102109
docker:
103110
- image: node:latest
104111
steps:
112+
# checkout code to default ~/project
105113
- checkout
106114
- attach_workspace:
107-
at: ~/build
115+
# the freshly built CHANGES.md will be in ~/changelog_build/CHANGES.md
116+
at: ~/.
108117
- run:
109118
name: install remark and extensions
110119
command: npm install `cat npm-requirements.txt`
111120
- run:
112121
name: remark on autogenerated CHANGES.md
122+
# format changelog, then use sed to change * to -, then lint changelog
113123
command: |
114-
mkdir ~/project/src/tmp
124+
git status
115125
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
126+
head -n 100 ~/changelog_build/CHANGES.md
127+
npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
128+
head -n 100 ~/changelog_build/CHANGES.md
129+
sed -i 's/* /- /' ~/changelog_build/CHANGES.md
130+
head -n 100 ~/changelog_build/CHANGES.md
131+
npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
119132
else
120133
echo "Commit or Release, do nothing"
121-
touch ~/project/src/tmp/empty.txt
122134
fi
123135
- persist_to_workspace:
124-
root: ~/project/src
125-
paths: tmp
136+
# fixed+linted changelog in ~/changelog_build/CHANGES.md
137+
root: ~/.
138+
paths: changelog_build
126139

127140
# Push built changelog to repo
128141
Changelog-bot:
129-
working_directory: ~/build
130142
docker:
131143
- image: circleci/openjdk:8-jdk
132144
steps:
133145
- setup_remote_docker:
134146
version: 17.11.0-ce
147+
# checkout code to default ~/project
135148
- checkout
136149
- attach_workspace:
137-
at: ~/build
150+
# fixed+linted changelog in ~/changelog_build/CHANGES.md
151+
at: ~/.
138152
- deploy:
139153
name: Changelog deployment
140-
working_directory: ~/build
154+
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
141155
command: |
142156
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
157+
mv ~/changelog_build/CHANGES.md ~/project/src/CHANGES.md
144158
merge_message=$(git log -1 | grep Merge | grep "pull")
145159
PR_number=$(echo $merge_message | cut -d ' ' -f 4)
146160
git config credential.helper 'cache --timeout=120'
147161
git config user.email "[email protected]"
148162
git config user.name "bids-maintenance"
149-
git add ~/build/src/CHANGES.md
163+
git add ~/project/src/CHANGES.md
150164
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
151165
git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master
152166
else

0 commit comments

Comments
 (0)