Skip to content

Commit

Permalink
update doc workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirMardan committed Apr 2, 2024
1 parent e75253d commit 48df667
Show file tree
Hide file tree
Showing 17 changed files with 331 additions and 154 deletions.
67 changes: 31 additions & 36 deletions .github/workflows/docs_pages_workflow.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
name: docs_pages_workflow

# execute this workflow automatically when a we push to main
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
name: documentation

on:
push:
branches : ["main", dev]
pull_request:
branches : ["main"]

permissions:
contents: write

jobs:

build_docs_job:
docs:
runs-on: ubuntu-latest
container: debian:buster-slim

steps:

- name: 🗑 Delete deployment
uses: strumwolf/delete-deployment-environment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: github-pages
onlyRemoveDeployments: true

- name: Prereqs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
apt-get update
apt-get install -y git
git clone "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
shell: bash

- name: Execute script to build our documentation and update pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x docs/docs_page.sh
"docs/docs_page.sh"
shell: bash
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install -r requirements.txt
- name: Sphinx build
run: |
sphinx-build docs _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
121 changes: 7 additions & 114 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,124 +13,17 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = extensions = [
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
]
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'myst_parser', # for having better markdown using MyST
'sphinx.ext.mathjax' # for equations
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']

source_suffix = ['.rst', '.md']

# The master toctree document.
master_doc = 'index'

# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

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

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']



# -- Extension configuration -------------------------------------------------

# add sourcecode to path
import sys, os
sys.path.insert(0, os.path.abspath('../first_break_picking'))

############################
# SETUP THE RTD LOWER-LEFT #
############################
try:
html_context
except NameError:
html_context = dict()
html_context['display_lower_left'] = True

if 'REPO_NAME' in os.environ:
REPO_NAME = os.environ['REPO_NAME']
else:
REPO_NAME = ''

# SET CURRENT_LANGUAGE
if 'current_language' in os.environ:
# get the current_language env var set by buildDocs.sh
current_language = os.environ['current_language']
else:
# the user is probably doing `make html`
# set this build's current language to english
current_language = 'en'

# tell the theme which language to we're currently building
html_context['current_language'] = current_language

# SET CURRENT_VERSION
from git import Repo
repo = Repo( search_parent_directories=True )

if 'current_version' in os.environ:
# get the current_version env var set by buildDocs.sh
current_version = os.environ['current_version']
else:
# the user is probably doing `make html`
# set this build's current version by looking at the branch
current_version = repo.active_branch.name

# tell the theme which version we're currently on ('current_version' affects
# the lower-left rtd menu and 'version' affects the logo-area version)
html_context['current_version'] = current_version
html_context['version'] = current_version

# POPULATE LINKS TO OTHER LANGUAGES
html_context['languages'] = [ ('en', '/' +REPO_NAME+ '/en/' +current_version+ '/') ]

languages = ["en"] # [lang.name for lang in os.scandir('locales') if lang.is_dir()]
for lang in languages:
html_context['languages'].append( (lang, '/' +REPO_NAME+ '/' +lang+ '/' +current_version+ '/') )

# POPULATE LINKS TO OTHER VERSIONS
html_context['versions'] = list()

versions = [branch.name for branch in repo.branches]
for version in versions:
html_context['versions'].append( (version, '/' +REPO_NAME+ '/' +current_language+ '/' +version+ '/') )

# POPULATE LINKS TO OTHER FORMATS/DOWNLOADS

# settings for creating PDF with rinoh
rinoh_documents = [(
master_doc,
'target',
project+ ' Documentation',
'© ' +copyright,
)]
today_fmt = "%B %d, %Y"

# settings for EPUB
epub_basename = 'target'

html_context['downloads'] = list()
html_context['downloads'].append( ('pdf', '/' +REPO_NAME+ '/' +current_language+ '/' +current_version+ '/' +project+ '-docs_' +current_language+ '_' +current_version+ '.pdf') )

html_context['downloads'].append( ('epub', '/' +REPO_NAME+ '/' +current_language+ '/' +current_version+ '/' +project+ '-docs_' +current_language+ '_' +current_version+ '.epub') )

##########################
# "EDIT ON GITHUB" LINKS #
##########################

html_context['display_github'] = True
html_context['github_user'] = 'amirmardan'
html_context['github_repo'] = 'first_break_picking'
html_context['github_version'] = 'main/docs/'

html_static_path = ['_static']
Binary file added docs/imgs/edf.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_data_preparing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_introducing_fb_segmentation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_predict_one.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_preprocessed_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/fb_train.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/waves.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@
Welcome to First Break Picking's documentation!
===============================================

.. figure:: ./imgs/github.png
:width: 20
:alt: git
:target: https://github.com/geo-stack/first_break_picking

.. toctree::
:maxdepth: 1
:caption: Quick Start:

source/readme
readme.md

.. toctree::
:maxdepth: 1
:caption: Contents:
:caption: Train and Predict:

train

source/modules
predict


19 changes: 19 additions & 0 deletions docs/predict.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Predict
=======


first\_break\_picking.train\_eval.ai\_tools
-------------------------------------------

.. automodule:: first_break_picking.train_eval.ai_tools
:members: save_checkpoint, load_checkpoint
:undoc-members:
:show-inheritance:

first\_break\_picking.train\_eval.predict module
------------------------------------------------

.. automodule:: first_break_picking.train_eval.predict
:members: predict
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 48df667

Please sign in to comment.