Skip to content

Commit

Permalink
Merge branch 'master' into enh/metadata_statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff authored Jul 13, 2022
2 parents 679b8e0 + ea02934 commit 077223e
Show file tree
Hide file tree
Showing 186 changed files with 24,501 additions and 4,482 deletions.
137 changes: 83 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,90 @@ version: 2
jobs:
build_docs:
docker:
- image: circleci/python:3.8
- image: cimg/python:3.8
steps:
# checkout code to default ~/project
- checkout
- run:
name: install dependencies
command: |
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ~/project/tools/schemacode/
- run:
name: generate docs
command: mkdocs build --clean --strict --verbose
command: |
source env/bin/activate
mkdocs build --clean --strict --verbose
- persist_to_workspace:
root: .
# the mkdocs build outputs are in ~/project/site
root: ~/project
paths: site
- store_artifacts:
path: ~/project/site/
destination: dev_docs

linkchecker:
docker:
- image: yarikoptic/linkchecker:9.4.0.anchorfix1-1
- image: cimg/python:3.8
steps:
# checkout code to default ~/project
- checkout
- attach_workspace:
at: ~/build
# mkdocs build outputs will be in ~/project/site
at: ~/project
- run:
name: install linkchecker
command: |
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
python -m pip install linkchecker
- run:
name: check links
command: |
if (! git log -1 --pretty=%b | grep REL:) ; then
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 \
--ignore-url "https://github.com/bids-standard/bids-specification/(pull|tree)/.*" \
--ignore-url "https://github.com/[^/]*" \
~/build/site/*html ~/build/site/*/*.html
source env/bin/activate
git status
if (! git log -1 --pretty=oneline | grep REL:) ; then
chmod a+rX -R ~
linkchecker -t 1 ~/project/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' \
--ignore-url 'https://github.com/bids-standard/bids-specification/(pull|tree)/.*' \
--ignore-url 'https://github.com/[^/]*' \
--ignore-url 'https://doi.org/.*' \
--ignore-url 'https://bids-specification.readthedocs.io/en/stable/.*' \
~/project/site/*html ~/project/site/*/*.html
else
echo "Release PR - do nothing"
echo "Release PR - do nothing"
fi
build_docs_pdf:
working_directory: ~/bids-specification/pdf_build_src
docker:
- image: danteev/texlive:latest
steps:
- checkout:
path: ~/bids-specification
# checkout code to default ~/project
- checkout
- run:
name: install dependencies
command: |
python -m pip install --upgrade pip
pip install -r ../requirements.txt
apt-get update && apt install -y python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install -r ~/project/requirements.txt
- run:
name: install font that works with unicode emojis
command: apt-get update && apt-get install -y fonts-symbola
- run:
name: generate pdf version docs
command: bash build_pdf.sh
command: |
cd ~/project/pdf_build_src
bash build_pdf.sh
mv ~/project/pdf_build_src/bids-spec.pdf ~/project/bids-spec.pdf
- store_artifacts:
path: bids-spec.pdf

Expand All @@ -69,84 +96,94 @@ jobs:
steps:
- setup_remote_docker:
version: 18.06.0-ce
# checkout code to default ~/project
- checkout
- run:
name: Build changelog
working_directory: ~/build
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
command: |
mkdir ~/changelog_build
git status
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 \
--output ~/changelog_build/CHANGES.md \
--base ~/project/src/pregh-changes.md \
--header-label "# Changelog" \
--no-issues \
--no-issues-wo-labels \
--no-filter-by-milestone \
--no-compare-link \
--pr-label "" \
--release-branch master
cat ~/build/CHANGES.md
mv ~/build/CHANGES.md ~/build/src/CHANGES.md
cat ~/changelog_build/CHANGES.md
else
echo "Commit or Release, do nothing"
fi
- persist_to_workspace:
root: .
paths: src
# raw generated changelog in ~/changelog_build/CHANGES.md
root: ~/.
paths: changelog_build

# Run remark on the auto generated changes.md file
remark:
docker:
- image: node:latest
- image: cimg/node:lts
steps:
# checkout code to default ~/project
- checkout
- attach_workspace:
at: ~/build
# the freshly built CHANGES.md will be in ~/changelog_build/CHANGES.md
at: ~/.
- run:
name: install remark and extensions
command: npm install `cat npm-requirements.txt`
- run:
name: remark on autogenerated CHANGES.md
# format changelog, then use sed to change * to -, then lint changelog
command: |
mkdir ~/project/src/tmp
git status
if (git log -1 --pretty=%s | grep Merge*) && (! git log -1 --pretty=%b | grep REL:) ; then
cat ~/build/src/CHANGES.md
cp ~/build/src/CHANGES.md ~/project/src/tmp/CHANGES.md
npx remark ~/project/src/tmp/CHANGES.md --frail --rc-path .remarkrc
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --rc-path ~/project/.remarkrc --output ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
sed -i 's/* /- /' ~/changelog_build/CHANGES.md
head -n 100 ~/changelog_build/CHANGES.md
npx remark-cli ~/changelog_build/CHANGES.md --frail --rc-path ~/project/.remarkrc
else
echo "Commit or Release, do nothing"
touch ~/project/src/tmp/empty.txt
fi
- persist_to_workspace:
root: ~/project/src
paths: tmp
# fixed+linted changelog in ~/changelog_build/CHANGES.md
root: ~/.
paths: changelog_build

# Push built changelog to repo
Changelog-bot:
working_directory: ~/build
docker:
- image: circleci/openjdk:8-jdk
- image: cimg/base:stable
steps:
- setup_remote_docker:
version: 17.11.0-ce
# checkout code to default ~/project
- checkout
- attach_workspace:
at: ~/build
# fixed+linted changelog in ~/changelog_build/CHANGES.md
at: ~/.
- deploy:
name: Changelog deployment
working_directory: ~/build
# $CHANGE_TOKEN is generated via the GitHub web UI, and then securely stored within CircleCI web UI
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
mv ~/changelog_build/CHANGES.md ~/project/src/CHANGES.md
merge_message=$(git log -1 | grep Merge | grep "pull")
PR_number=$(echo $merge_message | cut -d ' ' -f 4)
git config credential.helper 'cache --timeout=120'
git config user.email "bids.maintenance@gmail.com"
git config user.name "bids-maintenance"
git add ~/build/src/CHANGES.md
git add ~/project/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
Expand Down Expand Up @@ -177,12 +214,4 @@ workflows:
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
- build_docs_pdf
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.png -text
*.jpg -text
*.webm -text
tools/schemacode/schemacode/_version.py export-subst
20 changes: 20 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@master
with:
skip: js,*.svg
ignore_words_list: fo,te,als
2 changes: 1 addition & 1 deletion .github/workflows/markdown_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
markdown-style:
runs-on : ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/no-bad-latin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This action initially adopted from The Turing Way from in October 2020.
# doi:10.5281/zenodo.3233853
# https://github.com/alan-turing-institute/the-turing-way/blob/af98c94/.github/workflows/no-bad-latin.yml
#
#
# This action triggers the script tools/no-bad-latin.py to and will throw an error if any latin expression (like e.g. or i.e.) is detected:
#
#
# This action will be triggered
# - on a push to master
# - on a PR to the master branch and will only check files that were modified in src
Expand All @@ -31,10 +31,10 @@ jobs:
# This section collects together the steps involved in running the test
steps:
# Checkout the repository. Relies on another GH-Action.
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Set up the Python version. Relies on another GH-Action.
- name: Setup Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v3
with:
python-version: 3.7
# Install Python dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifact-path: 0/bids-spec.pdf
circleci-jobs: build_docs_pdf
job-title: Check the rendered PDF version here!
Loading

0 comments on commit 077223e

Please sign in to comment.