Skip to content

Commit

Permalink
first attempt at getting website to rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed Nov 19, 2021
1 parent dda9b6e commit a575b6e
Show file tree
Hide file tree
Showing 20 changed files with 481 additions and 1,203 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: EM Website Build

on:
push:
branches:
- '*'
pull_request:
branches: [ main ]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest -s -v tests
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build pages
run: |
python _ext/build_contrib_case.py
make html
python copy_images
- name: GitHub Pages
uses: crazy-max/[email protected]
with:
build_dir: _build/html
fqdn: em.geosci.xyz
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 0 additions & 14 deletions _ext/__init__.py

This file was deleted.

65 changes: 2 additions & 63 deletions _ext/autodoc.py → _ext/build_contrib_case.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shutil
import os
import json
import io
Expand All @@ -8,10 +7,10 @@
CONTRIB_INFO = ['affiliation', 'location', 'email', 'url', 'ORCID']
CASEHISTORY_INFO = ['citations', 'contributors', 'tags']

ORCID_URL = u'http://orcid.org/'
ORCID_URL = 'http://orcid.org/'

THIS_IS_AUTOGENERATED = (
u".. --------------------------------- ..\n"
".. --------------------------------- ..\n"
".. ..\n"
".. THIS FILE IS AUTO GENEREATED ..\n"
".. ..\n"
Expand All @@ -21,48 +20,6 @@
)


def make_formula_sheet():

# Create the examples dir in the docs folder.

EquationSheetDir = os.path.sep.join(
fName.split(os.path.sep)[:-2] + ['content', 'equation_bank']
)
files = os.listdir(EquationSheetDir)

rst = os.path.sep.join(
(fName.split(os.path.sep)[:-2] + ['content', 'equation_bank' + '.rst'])
)

out = u""".. _equation_bank:
{}
Equation Bank
=============
""".format(THIS_IS_AUTOGENERATED)

print('\nCreating: equation_bank.rst')
f = open(rst, 'w')
f.write(out)

for name in files:
out = """
- {}
.. include:: equation_bank/{}
""".format(name.rstrip('.rst'), name)
f.write(out)

f.close()

print('Done writing equation_bank.rst\n')


def make_contributorslist(fpath='contributors.json',
fout='contributors.rst',
contrib_info=CONTRIB_INFO):
Expand Down Expand Up @@ -335,28 +292,10 @@ def make_case_histories(fpath='content/case_histories/case_histories.json',
print('Done writing case_histories.rst')


# .. raw:: html

# <span id="{uid}"></span><h3><a class="referance internal" href="{source}/index.html" title="Go to the case history">{title}</a></h3>
# <div class="row">
# <div class="col-md-6">
# <a class="reference internal image-reference" href="../../_images/{thumbnail}"><img alt="../../_images/{thumbnail}" class="align-left" src="../../_images/{thumbnail}" style="width: 250px;" /></a>
# </div>
# <div class="col-md-6">
# <ul>
# {info_block}
# </ul>
# </div>
# <br>
# <br>
# </div>


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

make_formula_sheet()
make_contributorslist()
make_case_histories()
15 changes: 10 additions & 5 deletions _ext/copyImages.py → _ext/copy_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import shutil

def copyImages():

def copy_images():
# get relevant directories
cwd = os.getcwd()
contentdir = os.path.sep.join(cwd.split(os.path.sep) + ['content'])
Expand All @@ -27,9 +28,13 @@ def copyImages():
if root.endswith('images'):
for filename in fileList:
if filename not in imnames:
shutil.copy(os.path.join(root, filename),buildimagesdir)
return
print(f'copying in {filename}')
shutil.copy(os.path.join(root, filename), buildimagesdir)


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

if __name__ == "__main__":
copyImages()
copy_images()
39 changes: 0 additions & 39 deletions _ext/edit_on_github.py

This file was deleted.

34 changes: 0 additions & 34 deletions _ext/environmentSetup.py

This file was deleted.

52 changes: 0 additions & 52 deletions _ext/includeMath.py

This file was deleted.

Loading

0 comments on commit a575b6e

Please sign in to comment.