Skip to content

Commit

Permalink
Merge pull request #3 from QuantEcon/maint-gha
Browse files Browse the repository at this point in the history
MAINT: Update github action scripts
  • Loading branch information
mmcky authored Jan 23, 2024
2 parents fd34a91 + e404b82 commit 35c2da3
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 247 deletions.
96 changes: 42 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,90 +1,78 @@
name: Build Project [using jupyter-book]
name: Build HTML [using jupyter-book]
on: [pull_request]
jobs:
deploy-runner:
preview:
runs-on: ubuntu-latest
steps:
- uses: iterative/setup-cml@v1
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Setup Anaconda
uses: conda-incubator/setup-miniconda@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Deploy runner on EC2
env:
REPO_TOKEN: ${{ secrets.QUANTECON_SERVICES_PAT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.11"
environment-file: environment.yml
activate-environment: quantecon
- name: Graphics Support #TODO: Review if graphviz is needed
run: |
cml runner launch \
--cloud=aws \
--cloud-region=us-west-2 \
--cloud-type=p3.2xlarge \
--labels=cml-gpu \
--cloud-hdd-size=40
preview:
needs: deploy-runner
runs-on: [self-hosted, cml-gpu]
container:
image: docker://mmcky/quantecon-lecture-python:cuda-12.1.0-anaconda-2023-09-py311-c
options: --gpus all
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
# Check nvidia drivers
- name: nvidia Drivers
shell: bash -l {0}
run: nvidia-smi
sudo apt-get -qq update && sudo apt-get install -y graphviz
- name: Install latex dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-xetex \
latexmk \
xindy \
dvipng \
cm-super
- name: Display Conda Environment Versions
shell: bash -l {0}
run: conda list
- name: Display Pip Versions
shell: bash -l {0}
run: pip list
- name: Download "build" folder (cache)
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v3
with:
workflow: cache.yml
branch: main
name: build-cache
path: _build
# Build Assets (Download Notebooks and PDF via LaTeX)
- name: Build Download Notebooks (sphinx-tojupyter)
shell: bash -l {0}
run: |
jb build lectures -n -W --keep-going --path-output ./ --builder=custom --custom-builder=jupyter
mkdir -p _build/html/_notebooks
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
- name: Upload Execution Reports (Download Notebooks)
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/jupyter/reports
- name: Build PDF from LaTeX
shell: bash -l {0}
run: |
jb build lectures --builder pdflatex --path-output ./ -W --keep-going
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
mkdir -p _build/html/_pdf
cp -u _build/latex/*.pdf _build/html/_pdf
- name: Upload Execution Reports (LaTeX)
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/latex/reports
# Final Build of HTML
- name: Build Download Notebooks (sphinx-tojupyter)
shell: bash -l {0}
run: |
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
mkdir -p _build/html/_notebooks
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
# Build HTML (Website)
# BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes
# and clear the sphinx cache for building final HTML documents.
- name: Build HTML
shell: bash -l {0}
run: |
jb build lectures --path-output ./ -n -W --keep-going
rm -r _build/.doctrees
jb build lectures --path-output ./ -nW --keep-going
- name: Upload Execution Reports (HTML)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: execution-reports
path: _build/html/reports
- name: Preview Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
uses: nwtgck/actions-netlify@v2
with:
publish-dir: '_build/html/'
production-branch: main
Expand Down
111 changes: 0 additions & 111 deletions .github/workflows/execution.yml

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Link Checker [Anaconda, Linux]
on:
pull_request:
types: [opened, reopened]
# schedule:
# # UTC 12:00 is early morning in Australia
# - cron: '0 12 * * *'
schedule:
# UTC 12:00 is early morning in Australia
- cron: '0 12 * * *'
jobs:
link-check-linux:
name: Link Checking (${{ matrix.python-version }}, ${{ matrix.os }})
Expand All @@ -16,18 +16,18 @@ jobs:
python-version: ["3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Anaconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: '3.11'
python-version: "3.11"
environment-file: environment.yml
activate-environment: quantecon
- name: Download "build" folder (cache)
uses: dawidd6/action-download-artifact@v2
uses: dawidd6/action-download-artifact@v3
with:
workflow: cache.yml
branch: main
Expand All @@ -37,7 +37,7 @@ jobs:
shell: bash -l {0}
run: jb build lectures --path-output=./ --builder=custom --custom-builder=linkcheck
- name: Upload Link Checker Reports
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: linkcheck-reports
Expand Down
Loading

1 comment on commit 35c2da3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.