Skip to content

Commit

Permalink
Attempt doc preview with mystjs. (#212)
Browse files Browse the repository at this point in the history
* Attempt doc preview with mystjs.

* Introspect build env vars.

* Use BASE_URL

Co-authored-by: Rowan Cockett <rowanc1@gmail.com>

* Rm debugging step from CCI workflow.

---------

Co-authored-by: Brigitta Sipőcz <b.sipocz@gmail.com>
Co-authored-by: Rowan Cockett <rowanc1@gmail.com>
  • Loading branch information
3 people authored Jun 5, 2024
1 parent 486426e commit 7b75b2c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
54 changes: 30 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build-docs:
working_directory: ~/repo
docker:
- image: cimg/python:3.10
- image: cimg/python:3.10-node

steps:
- checkout
Expand All @@ -17,7 +17,7 @@ jobs:
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip wheel setuptools
pip install -r site/requirements.txt -r requirements.txt
pip install -r requirements.txt
- restore_cache:
keys:
Expand All @@ -30,52 +30,58 @@ jobs:
# NOTE: blas multithreading behaves badly on circleci
export OMP_NUM_THREADS=1
source venv/bin/activate
# n = nitpicky (broken links), W = warnings as errors,
# T = full tracebacks, keep-going = run to completion even with errors
make -C site/ SPHINXOPTS="-nWT --keep-going" html
# Construct the BASE_URL using the CIRCLE_WORKFLOW_JOB_ID
export BASE_URL="/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/_build/html"
# Output the BASE_URL for debugging purposes
echo "BASE_URL is set to $BASE_URL"
# Run your myst build command
myst build --html --execute
- save_cache:
key: cache-data
paths:
- _data

- store_artifacts:
path: site/_build/html
path: _build/html

- persist_to_workspace:
root: site/_build
root: _build
paths: html

deploy-docs:
working_directory: ~/repo
docker:
- image: cimg/python:3.10
- image: cimg/python:3.10-node
steps:
- checkout

- attach_workspace:
at: site/_build
at: _build

- run:
name: install deploy deps
command : |
python3 -m pip install --user ghp-import
- run:
name: configure git
command: |
git config --global user.name "ci-doc-deploy-bot"
git config --global user.email "ci-doc-deploy-bot@nomail"
git config --global push.default simple
- add_ssh_keys:
fingerprints:
5c:54:62:37:75:7f:4d:14:f4:07:82:1c:50:0d:ee:9b

- run:
name: deploy to gh-pages
command: |
ghp-import -n -f -p -m "[skip ci] docs build of $CIRCLE_SHA1" site/_build/html
# TODO!
# - run:
# name: configure git
# command: |
# git config --global user.name "ci-doc-deploy-bot"
# git config --global user.email "ci-doc-deploy-bot@nomail"
# git config --global push.default simple
#
# - add_ssh_keys:
# fingerprints:
# 5c:54:62:37:75:7f:4d:14:f4:07:82:1c:50:0d:ee:9b
#
# - run:
# name: deploy to gh-pages
# command: |
# ghp-import -n -f -p -m "[skip ci] docs build of $CIRCLE_SHA1" site/_build/html
workflows:
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ pandas
imageio
# For supporting .md-based notebooks
jupytext
mystmd
ipykernel
jupyter_server
jupyterlab-myst

0 comments on commit 7b75b2c

Please sign in to comment.