Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1819 automation doc warnings #1836

Merged
merged 2 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/jobs/build_documentation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/bash

# path to docs directory relative to top level of repository
# $GITHUB_WORKSPACE is set if the actions/checkout@v2 action is run first

DOCS_DIR=${GITHUB_WORKSPACE}/met/docs

# run Make to build the documentation and return to previous directory
cd ${DOCS_DIR}
make clean html
cd -

# copy HTML output into directory to create an artifact
mkdir -p artifact/documentation
cp -r ${DOCS_DIR}/_build/html/* artifact/documentation

# check if the warnings.log file is empty
# Copy it into the artifact and documentation directories
# so it will be available in the artifacts
warning_file=${DOCS_DIR}/_build/warnings.log
if [ -s $warning_file ]; then
cp -r ${DOCS_DIR}/_build/warnings.log artifact/doc_warnings.log
cp artifact/doc_warnings.log artifact/documentation
exit 1
fi
22 changes: 6 additions & 16 deletions .github/workflows/main.yml → .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MET CI/CD Workflow
name: Documentation
on:
push:
branches:
Expand All @@ -7,6 +7,8 @@ on:
- feature_*
- main_*
- bugfix_*
paths:
- met/docs/**
pull_request:
types: [opened, reopened, synchronize]

Expand All @@ -24,26 +26,14 @@ jobs:
python -m pip install --upgrade python-dateutil requests sphinx \
sphinx-gallery Pillow sphinx_rtd_theme
- name: Build docs
continue-on-error: true
run: |
DOCS_DIR=${GITHUB_WORKSPACE}/met/docs
cd ${DOCS_DIR}
make clean html
cd ${GITHUB_WORKSPACE}
warning_file=${DOCS_DIR}/_build/warnings.log
mkdir -p artifact/documentation
cp -r ${DOCS_DIR}/_build/html/* artifact/documentation
if [ -s $warning_file ]; then
cp -r ${DOCS_DIR}/_build/warnings.log artifact/doc_warnings.log
cp artifact/doc_warnings.log artifact/documentation
else
rm ${warning_file}
fi
run: ./.github/jobs/build_documentation.sh
- uses: actions/upload-artifact@v2
if: always()
with:
name: documentation
path: artifact/documentation
- uses: actions/upload-artifact@v2
if: failure()
with:
name: documentation_warnings.log
path: artifact/doc_warnings.log
Expand Down