Skip to content

Commit 7c8db61

Browse files
committed
fix circleci workflow
1 parent 9c35577 commit 7c8db61

File tree

1 file changed

+53
-38
lines changed

1 file changed

+53
-38
lines changed

.circleci/config.yml

Lines changed: 53 additions & 38 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,57 @@ 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:
4548
working_directory: ~/bids-specification/pdf_build_src
4649
docker:
4750
- image: danteev/texlive:latest
4851
steps:
49-
- checkout:
50-
path: ~/bids-specification
52+
# checkout code to default ~/project
53+
- checkout
5154
- run:
5255
name: install dependencies
5356
command: |
5457
python -m pip install --upgrade pip
55-
pip install -r ../requirements.txt
58+
pip install -r ~/project/requirements.txt
5659
- run:
5760
name: install font that works with unicode emojis
5861
command: apt-get update && apt-get install -y fonts-symbola
5962
- run:
6063
name: generate pdf version docs
61-
command: bash build_pdf.sh
64+
command: |
65+
cd ~/project/pdf_build_src
66+
bash build_pdf.sh
6267
- store_artifacts:
63-
path: bids-spec.pdf
68+
path: ~/project/pdf_build_src/bids-spec.pdf
6469

6570
# Auto changelog collector
6671
github-changelog-generator:
@@ -69,84 +74,94 @@ jobs:
6974
steps:
7075
- setup_remote_docker:
7176
version: 18.06.0-ce
77+
# checkout code to default ~/project
7278
- checkout
7379
- run:
7480
name: Build changelog
75-
working_directory: ~/build
81+
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
7682
command: |
83+
mkdir ~/changelog_build
84+
git status
7785
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
7886
github_changelog_generator \
7987
--user bids-standard \
8088
--project bids-specification \
8189
--token ${CHANGE_TOKEN} \
82-
--output ~/build/CHANGES.md \
83-
--base ~/build/src/pregh-changes.md \
90+
--output ~/changelog_build/CHANGES.md \
91+
--base ~/project/src/pregh-changes.md \
8492
--header-label "# Changelog" \
8593
--no-issues \
8694
--no-issues-wo-labels \
8795
--no-filter-by-milestone \
8896
--no-compare-link \
8997
--pr-label "" \
9098
--release-branch master
91-
cat ~/build/CHANGES.md
92-
mv ~/build/CHANGES.md ~/build/src/CHANGES.md
99+
cat ~/changelog_build/CHANGES.md
93100
else
94101
echo "Commit or Release, do nothing"
95102
fi
96103
- persist_to_workspace:
97-
root: .
98-
paths: src
104+
# raw generated changelog in ~/changelog_build/CHANGES.md
105+
root: ~/.
106+
paths: changelog_build
99107

100108
# Run remark on the auto generated changes.md file
101109
remark:
102110
docker:
103111
- image: node:latest
104112
steps:
113+
# checkout code to default ~/project
105114
- checkout
106115
- attach_workspace:
107-
at: ~/build
116+
# the freshly built CHANGES.md will be in ~/changelog_build/CHANGES.md
117+
at: ~/.
108118
- run:
109119
name: install remark and extensions
110120
command: npm install `cat npm-requirements.txt`
111121
- run:
112122
name: remark on autogenerated CHANGES.md
123+
# format changelog, then use sed to change * to -, then lint changelog
113124
command: |
114-
mkdir ~/project/src/tmp
125+
git status
115126
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
127+
head -n 100 ~/changelog_build/CHANGES.md
128+
npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
129+
head -n 100 ~/changelog_build/CHANGES.md
130+
sed -i 's/* /- /' ~/changelog_build/CHANGES.md
131+
head -n 100 ~/changelog_build/CHANGES.md
132+
npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
119133
else
120134
echo "Commit or Release, do nothing"
121-
touch ~/project/src/tmp/empty.txt
122135
fi
123136
- persist_to_workspace:
124-
root: ~/project/src
125-
paths: tmp
137+
# fixed+linted changelog in ~/changelog_build/CHANGES.md
138+
root: ~/.
139+
paths: changelog_build
126140

127141
# Push built changelog to repo
128142
Changelog-bot:
129-
working_directory: ~/build
130143
docker:
131144
- image: circleci/openjdk:8-jdk
132145
steps:
133146
- setup_remote_docker:
134147
version: 17.11.0-ce
148+
# checkout code to default ~/project
135149
- checkout
136150
- attach_workspace:
137-
at: ~/build
151+
# fixed+linted changelog in ~/changelog_build/CHANGES.md
152+
at: ~/.
138153
- deploy:
139154
name: Changelog deployment
140-
working_directory: ~/build
155+
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
141156
command: |
142157
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
158+
mv ~/changelog_build/CHANGES.md ~/project/src/CHANGES.md
144159
merge_message=$(git log -1 | grep Merge | grep "pull")
145160
PR_number=$(echo $merge_message | cut -d ' ' -f 4)
146161
git config credential.helper 'cache --timeout=120'
147162
git config user.email "[email protected]"
148163
git config user.name "bids-maintenance"
149-
git add ~/build/src/CHANGES.md
164+
git add ~/project/src/CHANGES.md
150165
git commit -m "[DOC] Auto-generate changelog entry for PR ${PR_number}"
151166
git push https://${CHANGE_TOKEN}@github.com/bids-standard/bids-specification.git master
152167
else

0 commit comments

Comments
 (0)