Skip to content

Commit

Permalink
add contribution workflow and dev deployment
Browse files Browse the repository at this point in the history
Contribution Guidelines
  • Loading branch information
thurber authored Jun 3, 2024
2 parents 6bbe199 + ac78bb7 commit 29a96f5
Show file tree
Hide file tree
Showing 14 changed files with 365 additions and 28 deletions.
73 changes: 73 additions & 0 deletions .github/ISSUE_TEMPLATE/contribution_proposal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Contribution Proposal
description:
Want to contribute to our eBook? Fill the following proposal form and we will review your contribution idea shortly.
labels: ["needs triage"]

body:
- type: markdown
attributes:
value: |
## Please fill out the form completly
See our `contribution documentation <https://uc-ebook.org/docs/html/contributing.html>`_ for additional information.
**NOTE**: We require that all contributions including any code, data, or other content provided with them be fully open source.
- type: textarea
id: issue-name
attributes:
label: Name
description: Please provide your name
validations:
required: true

- type: textarea
id: issue-email
attributes:
label: Email
description: Please provide your email address
validations:
required: true

- type: textarea
id: issue-institution
attributes:
label: Institution
description: Please provide your institution
validations:
required: true

- type: textarea
id: issue-source
attributes:
label: Referral
description: How did you hear about the eBook?
validations:
required: true

- type: dropdown
id: issue-category
attributes:
label: Topic Area
description: Select the part of the eBook you are hoping to contribute to.
options:
- General
- Sensitivity Analysis
- Uncertainty Quantification
- Jupyter Notebook
validations:
required: true

- type: textarea
id: issue-description
attributes:
label: Description
description: Please provide a detailed description of the content you wish to contribute.
validations:
required: true

- type: textarea
id: reproduction-info
attributes:
label: Additional Information
description: Please provide any additional information you want to share.
validations:
required: true
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/contribution_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Tutorial Contribution
The following upon submission starts the review process for your draft Jupyter notebook contribution to the eBook. Please see our [contribution documentation](https://uc-ebook.org/docs/html/contributing.html) for additional guidance.

## Contribution Issue Link
Please reference the link to your approved contribution issue here: # (issue)

## Checklist
Please ensure that you are able to check all of the following boxes before submission
- [ ] My contribution proposal has been approved
- [ ] I have performed a self-review of my own code
- [ ] All elements of my contribution are fully open-source and can be distributed with an [Open Source Initiative approved license](https://opensource.org/licenses/) with an understanding that they may be used in community demonstrations and other activities. Author citations will be present in the notebook for any contributed work to ensure the author(s) receive full credit for their contribution.
- [ ] Any data or code reused in your submission are correctly cited giving credit to the original authors.
- [ ] The notebook provided is written in English and able to be a stand-alone product that needs no further explanation past what is written in the notebook to make use of it.
- [ ] The provided work is not merely a regurgitation of an existing tutorial or demonstration but represents a novel contribution.
- [ ] All contributions and communication thereof must abide by our [code of conduct](https://uc-ebook.org/docs/html/code_of_conduct.html).

## Additional information

## Please upload your draft notebook as an attachment to this pull request
2 changes: 1 addition & 1 deletion .github/workflows/01_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

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

jobs:
build:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/02_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ jobs:
run: npm run build
- name: Commit documentation changes
run: |
cd landing/build
git clone --depth=1 --branch=gh-pages https://github.com/IMMM-SFA/msd_uncertainty_ebook.git previous_deploy
mkdir ./landing/build/dev
cp -r ./previous_deploy/dev/* ./landing/build/dev/
cd ./landing/build
git init
git add -A
git config --local user.email "[email protected]"
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/03_dev_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Deploy Dev

on:
push:
branches: [ dev ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install latex dependencies
run: sudo apt-get update -y && sudo apt-get install -y texlive latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended ghostscript
- name: Update pip and install python dependencies
working-directory: 'docs/'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build html and pdf ebook
working-directory: 'docs/'
env:
NODE_ENV: development
run: |
make html latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
continue-on-error: true
- name: Concatenate eBook cover with eBook
run: |
mv docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf docs/build/latex/ebook_content.pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf -dBATCH docs/ebook_cover.pdf docs/build/latex/ebook_content.pdf
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: landing/package-lock.json
- uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
SOURCE_DIR: 'notebooks'
DEST_DIR: 'notebooks'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DEV }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
AWS_REGION: ${{ secrets.AWS_REGION_DEV }}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: Dockerfile_dev
push: true
tags: thurber/uc-ebook.org:dev
- name: Install landing page dependencies
working-directory: 'landing/'
run: npm install
- name: Build landing page
working-directory: 'landing/'
env:
NODE_ENV: development
run: npm run build
- name: Commit documentation changes
run: |
git clone --depth=1 --branch=gh-pages https://github.com/IMMM-SFA/msd_uncertainty_ebook.git deploy
rm -rf ./deploy/.git
rm -rf ./deploy/dev
mkdir ./deploy/dev
cp -r ./landing/build/* ./deploy/dev/
cd ./deploy
git init
git add -A
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'deploy' -a || true
- name: Push changes to gh-pages
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: deploy
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
58 changes: 58 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Scope

This Code of Conduct applies within all community spaces, and also applies
when an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0,
available at https://www.contributor-covenant.org/version/2/0/
code_of_conduct.html.

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://
www.contributor-covenant.org/translations.
13 changes: 13 additions & 0 deletions Dockerfile_dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM jupyter/minimal-notebook:2022-05-03

USER root

RUN git clone --depth=1 --branch=dev https://github.com/IMMM-SFA/msd_uncertainty_ebook.git msd_uncertainty_ebook
RUN cd msd_uncertainty_ebook && pip install .

# Now create a symlinked data folder inside the msdbook package that links to /home/demo/data folder
RUN mkdir -p /home/demo/data
RUN rm -rf /opt/conda/lib/python3.9/site-packages/msdbook/data
RUN ln -s /home/demo/data /opt/conda/lib/python3.9/site-packages/msdbook/data


14 changes: 7 additions & 7 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
autodoc~=0.5.0
ipython~=8.0.1
mathjax~=0.1.2
nbsphinx~=0.8.6
sphinx~=4.0.2
sphinx-book-theme~=0.2.0
sphinxcontrib-bibtex~=2.4.1
autodoc>=0.5.0
ipython>=8.0.1
mathjax>=0.1.2
nbsphinx>=0.8.6
sphinx>=4.0.2
sphinx-book-theme>=0.2.0
sphinxcontrib-bibtex>=2.4.1
58 changes: 58 additions & 0 deletions docs/source/code_of_conduct.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Code of Conduct
===============

Our Pledge
----------

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

Our Standards
-------------

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Scope
-----

This Code of Conduct applies within all community spaces, and also applies
when an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event.

Attribution
-----------

This Code of Conduct is adapted from the Contributor Covenant, version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
20 changes: 12 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
sys.path.insert(0, os.path.abspath('../../'))
sys.path.append(os.path.abspath("../../extensions"))

# if this is a dev build, the paths need to be adjusted
dev_web = '/dev' if ('NODE_ENV' in os.environ and os.environ['NODE_ENV'] == 'development') else ''
dev_nb = '.dev' if ('NODE_ENV' in os.environ and os.environ['NODE_ENV'] == 'development') else ''

# current datetime to use as the version
today = f"Last updated: {datetime.utcnow().strftime('%b %d, %Y')}"


# -- Notebook URLs -----------------------------------------------------------

rst_prolog = """
.. _nb_logistic_regression: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/basin_users_logistic_regression.ipynb
.. _nb_saltelli_sobol: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/sa_saltelli_sobol_ishigami.ipynb
.. _nb_hymod: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/hymod.ipynb
.. _nb_fishery_dynamics: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/fishery_dynamics.ipynb
.. _nb_discovery: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/Bedford_Greene_SD_tutorial.ipynb
.. _nb_hmm: https://uc-ebook.msdlive.org/user-redirect/lab/tree/notebooks/Hidden-Markov_Modeling_Approaches_to_Creating_Synthetic_Streamflow_Scenarios.ipynb
rst_prolog = f"""
.. _nb_logistic_regression: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/basin_users_logistic_regression.ipynb
.. _nb_saltelli_sobol: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/sa_saltelli_sobol_ishigami.ipynb
.. _nb_hymod: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/hymod.ipynb
.. _nb_fishery_dynamics: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/fishery_dynamics.ipynb
.. _nb_discovery: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/Bedford_Greene_SD_tutorial.ipynb
.. _nb_hmm: https://uc-ebook{dev_nb}.msdlive.org/user-redirect/lab/tree/notebooks/Hidden-Markov_Modeling_Approaches_to_Creating_Synthetic_Streamflow_Scenarios.ipynb
"""


Expand Down Expand Up @@ -88,7 +92,7 @@

# theme options
html_theme_options = {
'path_to_docs': '/docs',
'path_to_docs': f'{dev_web}/docs',
'repository_url': 'https://github.com/IMMM-SFA/msd_uncertainty_ebook',
'use_issues_button': True,
'use_download_button': True,
Expand Down
Loading

0 comments on commit 29a96f5

Please sign in to comment.