Skip to content

Commit

Permalink
Merge pull request #263 from speth/website-reformat-sphinx-myst
Browse files Browse the repository at this point in the history
Convert website to Sphinx
  • Loading branch information
speth authored Dec 18, 2024
2 parents 6288cbe + 3892bc4 commit 8932c66
Show file tree
Hide file tree
Showing 218 changed files with 1,556 additions and 18,551 deletions.
84 changes: 19 additions & 65 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,83 +13,39 @@ on:
- testing

env:
NIKOLA_OUTPUT_DIR: output
WEBSITE_CLONE_DIR: website
SPHINX_OUTPUT_DIR: build/html
RSYNC_USER: "ctdeploy"
RSYNC_SERVER: "cantera.org"
DEPLOY: ${{ github.event_name == 'push' && github.repository_owner == 'Cantera' && (endswith(github.ref, 'main') || endsWith(github.ref, 'testing')) }}

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout the repository
with:
submodules: recursive
path: ${{ env.WEBSITE_CLONE_DIR }}
- uses: actions/checkout@v2
name: Checkout Cantera repository
with:
submodules: recursive
repository: Cantera/cantera
path: cantera
ref: "3.0"
- uses: actions/checkout@v2
name: Checkout Cantera 'main' repository
with:
submodules: recursive
repository: Cantera/cantera
path: cantera-dev
- uses: actions/checkout@v2
name: Checkout Cantera Jupyter repository
with:
repository: Cantera/cantera-jupyter
path: cantera-jupyter
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Upgrade pip
run: python3 -m pip install -U pip setuptools wheel
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(python3 -m pip cache dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Install dependencies
run: python3 -m pip install -r requirements.txt
working-directory: ${{ env.WEBSITE_CLONE_DIR }}

# Parse SCons configuration for development version and move reST file
- name: Parse configuration options from Cantera SConstruct as reST
python-version: 3.13
- name: Install pdm
run: |
cd cantera-dev
python3 `which scons` help --restructured-text --dev --output=scons-config-options-dev.rst
cd ..
mv -f cantera-dev/scons-config-options-dev.rst ${{ env.WEBSITE_CLONE_DIR }}/pages/compiling/
python3 -m pip install pdm
pdm install --verbose
- name: Build the site
run: NIKOLA_DEBUG=1 nikola build
working-directory: ${{ env.WEBSITE_CLONE_DIR }}
run: pdm run build

# Create artifact containing output
- name: Create archive for website output
run: |
cd ${{ env.WEBSITE_CLONE_DIR }}; \
tar -czf website.tar.gz ${{ env.NIKOLA_OUTPUT_DIR }}
tar -czf website.tar.gz ${{ env.SPHINX_OUTPUT_DIR }}
- name: Store archive of website output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: ${{ env.WEBSITE_CLONE_DIR }}/website.tar.gz
retention-days: 5
path: website.tar.gz
retention-days: 14

# The known_hosts key is generated with `ssh-keygen -F cantera.org` from a
# machine that has previously logged in to cantera.org and trusts
Expand All @@ -106,17 +62,15 @@ jobs:
RSYNC_DEST: "cantera"
run: |
rsync -avzP --checksum --exclude='*.map' --exclude='*.md5' \
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /documentation/dev/*' \
--filter='P /doc-versions.json' --filter='P /dev' --filter='P /stable' \
--filter='P /robots.txt' --filter='P .htaccess' \
"${WEBSITE_CLONE_DIR}/${NIKOLA_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /dev' \
--filter='P /?.?' --filter='P /stable' \
"${SPHINX_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
- name: Upload the docs
if: env.DEPLOY == 'true' && endsWith(github.ref, 'testing')
env:
RSYNC_DEST: "testing.cantera.org"
run: |
rsync -avzP --checksum --exclude='*.map' --exclude='*.md5' \
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /documentation/dev/*' \
--filter='P /doc-versions.json' --filter='P /dev' --filter='P /stable' \
--filter='P /robots.txt' --filter='P .htaccess' \
"${WEBSITE_CLONE_DIR}/${NIKOLA_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /dev' \
--filter='P /?.?' --filter='P /stable' \
"${SPHINX_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
75 changes: 60 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Nikola directories
output/
cache/
.doit.db.*
.doit.db*

# CI Support
.ci_support/ctdeploy_key
/dev-docs
/dev-docs/
pdm.lock

# Byte-compiled / optimized / DLL files
__pycache__/
Expand All @@ -29,6 +24,7 @@ parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -47,14 +43,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -64,6 +63,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -76,16 +76,49 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version
# IPython
profile_default/
ipython_config.py

# celery beat schedule file
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm-python

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py
Expand All @@ -111,9 +144,21 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# VS Code
.vscode/
# Cython debug symbols
cython_debug/

# macOS hidden files
*.DS_Store
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "api-docs"]
path = api-docs
url = https://github.com/Cantera/api-docs
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
language_version: python3
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
# Override default --ignore-missing-imports
args: []
additional_dependencies:
- sphinx
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit 8932c66

Please sign in to comment.