Skip to content

Commit

Permalink
GitHub pages (#23)
Browse files Browse the repository at this point in the history
* Create and upload sphinx docs.
* Still needs to fix version switcher.

---------

Signed-off-by: David Hart <[email protected]>
  • Loading branch information
dbhart authored Sep 15, 2024
1 parent ede0514 commit d1905da
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 22 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: release

on:
workflow_dispatch:

jobs:

wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl

source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: build the sdist
run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
54 changes: 40 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,44 @@ jobs:
strategy:
matrix:
version: ["3.9", "3.10", "3.11", "3.12"]
steps:

- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: Check out the commit
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ~${{ matrix.version }}

- name: Install development dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install tomli
- name: Test install
run: python3 -m pip install .[tests]

- name: Test with pytest
run: python3 -m pytest --cov=sansmic --cov=tests examples/ tests/

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ubuntu-latest

OSes:
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.12"]
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest]
steps:

Expand All @@ -29,10 +67,10 @@ jobs:
egress-policy: audit

- name: Check out the commit
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ~${{ matrix.version }}

Expand All @@ -54,18 +92,6 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.os }}

# - name: Check documentation coverage
# run: |
# make coverage
# mv build/coverage/python.txt ../docs-coverage-report-${{ matrix.version }}.txt
# working-directory: ./docs

# - name: Archive documentation coverage results
# uses: actions/upload-artifact@v3
# with:
# name: docs-coverage-report-${{ matrix.version }}
# path: docs-coverage-report-${{ matrix.version }}.txt

- name: Test uninstall
run: python3 -m pip uninstall -y my-repository-name

Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Deploy Sphinx content to GitHub Pages
name: Deploy Sphinx documentation

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
release:
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
name: Build the documentation with Sphinx
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch origin main
- name: troubleshooting
run: |
git branch
git remote -v
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install package
run: |
sudo apt-get install -y doxygen graphviz
pip install -e .[docs]
pip install -r requirements.txt
- name: Build documentation
run: sphinx-build docs/ docs/_build/html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/_build/html'

deploy:
name: Deploy documentation to GitHub Pages
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
with:
base_path: /sansmic/${{ github.ref_name }}
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ jobs:
matrix:
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl

source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: build the sdist
run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
14 changes: 14 additions & 0 deletions docs/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"name": "latest",
"version": "main",
"url": "https://sandialabs.github.io/sansmic/",
"preferred": true
},
{
"name": "v1.0.0-rc.1",
"version": "1.0.0rc1",
"url": "https://sandialabs.github.io/sansmic/1.0.0rc1/",
"preferred": true
}
]
16 changes: 13 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

sys.path.insert(0, os.path.abspath("../src/python"))

import sansmic

# -- Project information and custom options ----------------------------------
project = "sansmic"
copyright = "2024 National Technology and Engineering Solutions of Sandia, LLC. Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software."
author = "See AUTHORS.md"
doxygen_installed = True # determines whether or not to build the extension module documentation - doxygen must be installed for this to work
version = "1.0.0-rc.1"
version = sansmic.__version__.replace('-rc.', "rc")

# -- General configuration ---------------------------------------------------
extensions = [
Expand Down Expand Up @@ -217,10 +219,18 @@
"use_edit_page_button": False,
"primary_sidebar_end": ["indices.html"],
"show_toc_level": 2,
"switcher": {
"json_url": "https://sandialabs.github.io/sansmic/main/_static/switcher.json",
"version_match": version,
},
# "secondary_sidebar_items": ["page-toc"], #["page-toc", "edit-this-page", "sourcelink"],
"navbar_start": [
"navbar-logo",
"version-switcher",
],
"navbar_end": [
"theme-switcher.html",
"navbar-icon-links.html",
"theme-switcher",
"navbar-icon-links",
],
# "analytics": {"google_analytics_id": ""},
}
Expand Down

0 comments on commit d1905da

Please sign in to comment.