Skip to content

Commit

Permalink
Merge main into fixes/simpson
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-psi committed Jun 17, 2022
2 parents 556a4dc + f17f6d0 commit 4c9571a
Show file tree
Hide file tree
Showing 16 changed files with 868 additions and 29 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
---

name: Build Sphinx Docs

on:
push:
branches:
- 'main'
paths:
- 'docs/**'

jobs:
build: # job 1
name: 'Build HTML Docs'
runs-on: ubuntu-latest
environment: github-pages
if: github.actor != 'pdsen-ci'

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}

- name: Set up Python 3
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: Install dependencies
run: |
# Install Sphinx
pip install -r docs/requirements.txt
- name: Make Sphinx
id: make
run: |
cd docs
# Make the HTML docs and copy to main
make github
cd ..
- name: Push LDDs to Github
run: |
git config --local user.email "pdsen-ci@jpl.nasa.gov"
git config --local user.name "PDSEN CI Bot"
git add -A .
git commit --allow-empty -m "Auto-generated docs by PDSEN CI Bot"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
branch: gh-pages
force: true

pdfgen: # job 1
name: 'Build PDF'
runs-on: ubuntu-latest
environment: main
if: github.actor != 'pdsen-ci'

steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}

- name: Set up Python 3
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: Install dependencies
run: |
# Install Sphinx
pip install -r docs/requirements.txt
# Install dependencies for PDF generation
sudo apt install texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra latexmk
- name: Make Sphinx
id: make
run: |
cd docs
make latexpdf
cp build/latex/*.pdf .
- name: Push LDDs to Github
run: |
git config --local user.email "pdsen-ci@jpl.nasa.gov"
git config --local user.name "PDSEN CI Bot"
git add -A ./*.pdf
git commit --allow-empty -m "Auto-gen PDF by PDSEN CI Bot"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
branch: main
force: true
61 changes: 32 additions & 29 deletions .github/workflows/ldd-ci.yml → .github/workflows/submod-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
---
name: LDD Automation with PDSEN CI Bot
name: PDS4 Sub-Model Automation
on:
push:
branches:
Expand All @@ -16,7 +16,7 @@ env:

jobs:
get_versions:
name: Get Applicable PDS4 Versions
name: Get PDS4 Versions
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'
outputs:
Expand All @@ -29,23 +29,20 @@ jobs:

- id: set-matrix
run: |
# Look through lines and pull out the versions
while read -r line; do
if [[ ! -z "$line" ]]; then
versions=$versions'"'$line'"',
fi
done < $GITHUB_WORKSPACE/pds4_versions.txt
done < pds4_versions.txt
versions="[${versions::-1}]"
echo "{\"pds4_version\":${versions}}"
# Baseline: Set pds4 version to versions from file
echo "::set-output name=matrix::{\"pds4_version\": $versions}"
# Example of using development PDS4 Release for v1.16.0.0
# Update with appropriate version as needed
# echo "::set-output name=matrix::{\"pds4_version\": $versions, \"include\":[{\"pds4_version\":\"1.16.0.0\",\"pds4_development_release\":true}]}"
build:
name: 'LDD Build'
name: 'Generate and Validate'
needs: get_versions
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'
Expand All @@ -62,15 +59,15 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v1
with:
python-version: '3.7'
python-version: '3.9'

- name: Update submodules for dependencies
run: |
git submodule update --init --force --remote
- name: Generate LDDs
- name: Generate Sub-Models
id: generate
uses: NASA-PDS/gh-action-pds4-ldd@main
uses: NASA-PDS/sumo-gen-action@main
with:
data_path: ${{ format('{0}/{1}', env.DEPLOY_PATH, matrix.pds4_version) }}
pds4_im_version: ${{ matrix.pds4_version }}
Expand All @@ -80,10 +77,14 @@ jobs:
logs_path: ${{ env.LOGS_PATH }}
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}

- name: Upload LDDs to Github Action Artifacts
- name: Check logs
run: |
ls -R ${{ env.LOGS_PATH }}
- name: Upload Sub-Models to Github Action Artifacts
uses: actions/upload-artifact@v1
with:
name: v${{matrix.pds4_version}}_LDDs
name: v${{matrix.pds4_version}}_SubMods
path: ${{ env.DEPLOY_PATH }}
if: ${{ always() }}

Expand Down Expand Up @@ -112,7 +113,7 @@ jobs:

- name: Display structure of downloaded files
run: ls -R /tmp/artifacts

- name: Clean out old logs
run: |
path=$(dirname ${{ env.LOGS_PATH }})
Expand All @@ -128,16 +129,16 @@ jobs:
run: ls -R ${{ env.LOGS_PATH }}

- name: Push logs to Github
run: |
run: |
git config --local user.email "pdsen-ci@jpl.nasa.gov"
git config --local user.name "PDSEN CI Bot"
git add -A ${{ env.LOGS_PATH }}
git commit -m "Add logs from auto-generated LDD"
git commit -m "Add logs from failed SuMo generation"
git push origin HEAD
upload_all: # job 3
name: 'Add LDDs and Logs to Github'
name: 'Add SubMods and Logs to Github'
runs-on: ubuntu-latest
needs: build
if: ${{ github.actor != 'pdsen-ci' }}
Expand All @@ -153,25 +154,27 @@ jobs:
path: /tmp/artifacts

- name: Display structure of downloaded files
run: ls -R /tmp/artifacts
run: |
ls -R /tmp/artifacts
- name: Clean previous dev/snapshot tags
run: |
git fetch --prune --unshallow --tags
git tag -l | grep 'dev' | xargs -t -I arg sh -c 'git tag -d arg;git push --delete origin arg;'
- name: Clean out old LDDs and logs
- name: Clean out old SubMods and logs
run: |
path=$(dirname ${{ env.DEPLOY_PATH }})
rm -fr $path/*
path=$(dirname ${{ env.LOGS_PATH }})
path=${{ env.LOGS_PATH }}
rm -fr $path/*
- name: Move the LDDs to their new home
- name: Move the SubMods to their new home
run: |
mkdir -p ${{ env.DEPLOY_PATH }}
cp -R /tmp/artifacts/*LDDs/* ${{ env.DEPLOY_PATH }}
ls -R /tmp/artifacts/*SubMods/*
rsync -av /tmp/artifacts/*SubMods/* ${{ env.DEPLOY_PATH }}
- name: Display structure of downloaded files
run: ls -R ${{ env.DEPLOY_PATH }}
Expand All @@ -180,24 +183,24 @@ jobs:
shell: bash
run: |
if [[ "${{github.ref}}" == *"release"* ]]; then
echo "DEPLOY_PATH=${{github.workspace}}/build/release" >> $GITHUB_ENV
cp -R ${{ env.DEPLOY_PATH }}/* ${{github.workspace}}/build/release/
rsync -av /tmp/artifacts/*SubMods/* ${{github.workspace}}/build/release/
ls -R ${{github.workspace}}/build/release/
fi
- name: Move the execution logs to their new home
run: |
rm -fr ${{ env.LOGS_PATH }}
mkdir -p ${{ env.LOGS_PATH }}
cp -R /tmp/artifacts/*logs ${{ env.LOGS_PATH }}/
rsync -av /tmp/artifacts/*logs ${{ env.LOGS_PATH }}/
- name: Display structure of downloaded files
run: ls -R ${{ env.LOGS_PATH }}

- name: Push LDDs and Logs to Github
- name: Push SubMods and Logs to Github
run: |
git config --local user.email "pdsen-ci@jpl.nasa.gov"
git config --local user.name "PDSEN CI Bot"
git add -A $(dirname ${{ env.DEPLOY_PATH }}) ${{ env.LOGS_PATH }}
git commit -m "Auto-generated LDD by PDSEN CI Bot"
git add -A $(dirname ${{ env.DEPLOY_PATH }}) ${{ env.LOGS_PATH }} ${{github.workspace}}/build/release/
git commit -m "Auto-generated Sub-Model by PDSEN CI Bot"
git push origin HEAD
38 changes: 38 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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)

github:
@make clean checklinks html
@find .. -mindepth 1 -maxdepth 1 -type d -not -name "*git*" -not -name "*docs" -exec rm -fr {} \;
@cp -a build/html/. ..

cleaner:
@make clean
@find .. -mindepth 1 -maxdepth 1 -type d -not -name "*git*" -not -name "*docs" -exec rm -fr {} \;

.PHONY: help Makefile checklinks

# 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)


# LINKCHECKDIR = build/linkcheck

# .PHONY: checklinks
# checklinks:
# $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(LINKCHECKDIR)
# @echo
# @echo "Check finished. Report is in $(LINKCHECKDIR)."
Binary file added docs/build/latex/examplenamespace.pdf
Binary file not shown.
Binary file added docs/examplenamespace.pdf
Binary file not shown.
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

if "%1" == "" goto help

%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.http://sphinx-doc.org/
exit /b 1
)

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

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

:end
popd
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx==4.5.0
sphinx-rtd-theme==1.0.0
gitpython==3.1.9
sphinxemoji==0.2.0
myst-parser==0.17.2
Binary file added docs/source/_static/images/PDS_Planets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/source/_static/theme_overrides.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {

.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}

.wy-table-responsive {
overflow: visible !important;
}
}

/* replace the copyright to eliminate the copyright symbol enforced by
the ReadTheDocs theme but eschewed by our legal team */
div[role=contentinfo] {
visibility: hidden;
position: relative;
}

div[role=contentinfo]:after {
visibility: visible;
position: absolute;
top: 0;
left: 0;
content: "This is a work of the U.S. Government and is not subject to copyright pursuant to 17 USC 105.";
}
Loading

0 comments on commit 4c9571a

Please sign in to comment.