Build integrated AequilibraE docs #2028
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
env: | |
HAS_SECRETS: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --fix-missing libsqlite3-mod-spatialite libspatialite-dev pandoc latexmk texlive-latex-extra | |
python -m pip install --upgrade pip | |
pip install wheel openmatrix pytest | |
pip install -r requirements.txt | |
pip install -r docs/requirements-docs.txt | |
- name: Compile library | |
run: | | |
python setup.py build_ext --inplace | |
pip install . | |
- name: Check history of versions | |
run: | | |
python docs/table_documentation.py | |
python docs/create_docs_data.py | |
python docs/website/check_documentation_versions.py | |
- name: Test docstrings | |
run: | | |
python -m pytest --doctest-modules aequilibrae/distribution --ignore=aequilibrae/distribution/setup_ipf.py | |
python -m pytest --doctest-modules aequilibrae/matrix | |
python -m pytest --doctest-modules aequilibrae/paths --ignore=aequilibrae/paths/setup_assignment.py | |
python -m pytest --doctest-modules aequilibrae/project | |
python -m pytest --doctest-modules aequilibrae/log.py aequilibrae/parameters.py | |
python -m pytest --doctest-modules aequilibrae/transit | |
python -m pytest --doctest-glob=*.rst docs/source/python/modeling_with_aequilibrae/project_pieces | |
python -m pytest --doctest-glob=*.rst docs/source/python/modeling_with_aequilibrae/static_traffic_assignment | |
- name: Build documentation | |
run: | | |
jupyter nbconvert --to rst docs/source/python/useful_information/validation_benchmarking/IPF_benchmark.ipynb | |
sphinx-build -M latexpdf docs/source docs/source/_static -D plot_gallery=False | |
sphinx-build -D plot_gallery=False -b html docs/source docs/build | |
python3 -m zipfile -c AequilibraE.zip docs/build | |
cp AequilibraE.zip docs/source/_static | |
cp large_icon.png docs/source/_static/large_icon.png | |
cd docs | |
make html | |
- name: Upload python to DEV on S3 | |
if: ${{ (github.event_name == 'pull_request') && (env.HAS_SECRETS == 'true') }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'docs/build/html/' # optional: defaults to entire repository | |
DEST_DIR: 'test/' # optional: defaults to entire repository | |
# - name: Upload landing page to DEV on S3 | |
# if: ${{ (github.event_name == 'pull_request') && (env.HAS_SECRETS == 'true') }} | |
# run: | | |
# aws s3 cp html/build/docs/home.html s3://${{ secrets.AWS_S3_BUCKET }}/test/home.html --acl public-read | |
# env: | |
# AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# AWS_REGION: 'us-east-1' | |
- name: Upload to DEVELOP on S3 | |
if: ${{ (github.ref == 'refs/heads/develop') && (github.event_name == 'push') && (env.HAS_SECRETS == 'true') }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'docs/build/html/' # optional: defaults to entire repository | |
DEST_DIR: 'develop/' # optional: defaults to entire repository | |
- name: Upload to LATEST on S3 | |
if: ${{ (github.event_name == 'release') && (env.HAS_SECRETS == 'true') }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'docs/build/html/' # optional: defaults to entire repository | |
DEST_DIR: 'latest/' # optional: defaults to entire repository | |
- name: Create Documentation history folder | |
if: ${{ github.event_name == 'release'}} | |
run: python docs/website/redir.py | |
- name: Upload documentation to history folder | |
if: ${{ (github.event_name == 'release') && (env.HAS_SECRETS == 'true') }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --exclude '*.py' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'docs/website/' # optional: defaults to entire repository | |
DEST_DIR: 'docs/python/' # optional: defaults to entire repository | |
- name: Upload documentation to LATEST on AWS | |
if: ${{ (github.event_name == 'release') && (env.HAS_SECRETS == 'true') }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'docs/build/html/' # optional: defaults to entire repository | |
DEST_DIR: 'latest/' # optional: defaults to entire repository |