Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from biomarkersParkinson/workflow-improvements
Browse files Browse the repository at this point in the history
Publish documentation to github pages
  • Loading branch information
kretep authored Jul 4, 2024
2 parents b05b02a + f10fb31 commit 7bd42ff
Show file tree
Hide file tree
Showing 9 changed files with 1,020 additions and 5 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
python-version: ${{ matrix.python-version }}

# Get the version from pyproject.toml
# This will be used to tag the release in the publishing workflow
- name: Install toml package
run: pip install toml
- name: Get version from pyproject.toml
Expand All @@ -43,21 +44,38 @@ jobs:
echo Version: $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Installation
- name: Install dependencies
run: |
python -m pip install poetry
poetry install
# - name: Build the docs # just to see whether the build passes
# run: |
# poetry run mkdocs build
# Testing and checking
- name: Test with pytest
run: |
poetry run pytest
# - name: Type check
# run: |
# poetry run pytype .

# Build the package
- name: Build the package
run: |
poetry build
- name: Archive build artifacts
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/release'
with:
name: build-artifacts
path: dist/

# Build the docs
- name: Build the docs
run: |
poetry run make html --directory docs
- name: Archive documentation
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/release'
with:
name: docs-html
path: docs/_build/html/
21 changes: 20 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#workflow-definition
# https://github.com/marketplace/actions/pypi-publish

name: Publish to PyPI
name: Publish package and docs

on:
push:
Expand Down Expand Up @@ -94,3 +94,22 @@ jobs:
gh release upload
"v${VERSION}" dist/**
--repo '${{ github.repository }}'
publish-docs:
name: Publish documentation
needs: build-and-test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download the documentation
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
docs/build/
*.pyc
20 changes: 20 additions & 0 deletions docs/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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
27 changes: 27 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'paradigma'
copyright = '2024, NLeSC'
author = 'NLeSC'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. paradigma documentation master file, created by
sphinx-quickstart on Thu Jul 4 15:25:23 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to paradigma's documentation!
=====================================

.. toctree::
:maxdepth: 2
:caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Loading

0 comments on commit 7bd42ff

Please sign in to comment.