.github/workflows/pages.yml
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
env:
Python_Version: '3.9'
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches:
- main
jobs:
build_python_docs:
name: Build Python Documentation
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: Deploy-Static-Content-Pages
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{env.Python_Version}}
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Python Cache Key
shell: bash
run: |
echo $(which python) > /tmp/python_version.txt
- name: Get pip cache dir
shell: bash
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Upgrade
run: |
pip install --upgrade pip wheel setuptools build cmake ninja scikit-build
- name: Install Pip-Tools
shell: bash
run: |
python -m pip install pip-tools
- name: pip-compile setup.cfg
shell: bash
run: |
pip-compile setup.cfg
- name: pip-compile build-requirements.in
shell: bash
run: |
pip-compile build-requirements.in
- name: Pre Install Dependencies
shell: bash
run: |
set -eux
pip-sync requirements.txt build-requirements.txt
- name: pip-compile doc-requirements.in
shell: bash
run: |
pip-compile doc-requirements.in
- name: Install Dependencies
shell: bash
run: |
set -eux
pip-sync requirements.txt build-requirements.txt doc-requirements.txt
sudo apt-get install -y libeigen3-dev libopenblas-dev
python -m pip install -vvv .
- name: Install Dep
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y dvisvgm graphviz mscgen dia pdf2svg astyle doxygen doxygen-doxyparse fonts-liberation python3-breathe
npm install -g katex marked
- name: Prepare
shell: bash
run: |
set -eux
mkdir build
- name: CMake Configure
shell: bash
run: >
cmake
-DBUILD_DOCS=ON
-G Ninja
-S .
-B build
- name: CMake Build
shell: bash
run: >
cmake
--build build
--parallel
--verbose
--target cxxjij_header_only_docs
- name: Jupyter Book
run: |
jupyter-book build docs --all
- name: du -a
shell: bash
if: always()
run: |
du -a
- name: Prepare tag
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "deploy_tag_name=deploy-${TAG_NAME}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: HTML
path: ./docs/_build/html
retention-days: 30
# Single deploy job since we're just deploying
deploy:
needs: build_python_docs
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: HTML
path: ./html
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4