Skip to content

Commit

Permalink
update lectures and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
HumphreyYang committed Jan 17, 2024
1 parent 5244034 commit ba98b79
Show file tree
Hide file tree
Showing 869 changed files with 108,134 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Cache [using jupyter-book]
on:
push:
branches:
- main
jobs:
deploy-runner:
runs-on: ubuntu-latest
steps:
- uses: iterative/setup-cml@v1
- uses: actions/checkout@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 }}
run: |
cml runner launch \
--cloud=aws \
--cloud-region=us-west-2 \
--cloud-type=p3.2xlarge \
--labels=cml-gpu \
--cloud-hdd-size=40
cache:
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 }}
- name: Check nvidia drivers
shell: bash -l {0}
run: |
nvidia-smi
- name: Build HTML
shell: bash -l {0}
run: |
jb build lectures --path-output ./ -W --keep-going
- name: Upload Execution Reports
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/html/reports
- name: Upload "_build" folder (cache)
uses: actions/upload-artifact@v3
with:
name: build-cache
path: _build
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build Project [using jupyter-book]
on: [pull_request]
jobs:
deploy-runner:
runs-on: ubuntu-latest
steps:
- uses: iterative/setup-cml@v1
- uses: actions/checkout@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 }}
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
- 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
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
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 HTML
shell: bash -l {0}
run: |
jb build lectures --path-output ./ -n -W --keep-going
- name: Upload Execution Reports (HTML)
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/html/reports
- name: Preview Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: '_build/html/'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Preview Deploy from GitHub Actions"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
111 changes: 111 additions & 0 deletions .github/workflows/execution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Run Execution Tests [Latest Anaconda]
on:
schedule:
# UTC 22:00 is early morning in Australia
- cron: '0 22 * * *'
jobs:
execution-tests-linux:
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- 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: Install Anaconda + Dependencies
shell: bash -l {0}
run: |
conda install anaconda
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinxcontrib-youtube sphinx-exercise prettytable
- name: Build Lectures (+ Execution Checks)
shell: bash -l {0}
run: jb build lectures --path-output=./ -W --keep-going
- name: Upload Execution Reports
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/html/reports

execution-tests-osx:
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest"]
python-version: ["3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install latex dependencies
run: |
brew install texlive
- name: Install Anaconda + Dependencies
shell: bash -l {0}
run: |
conda install anaconda
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinxcontrib-youtube sphinx-exercise prettytable
- name: Build Lectures (+ Execution Checks)
shell: bash -l {0}
run: jb build lectures --path-output=./ -W --keep-going
- name: Upload Execution Reports
uses: actions/upload-artifact@v2
if: failure()
with:
name: execution-reports
path: _build/html/reports
# execution-tests-win:
# name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: ["windows-latest"]
# python-version: ["3.11"]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - uses: conda-incubator/setup-miniconda@v2
# with:
# auto-update-conda: true
# python-version: ${{ matrix.python-version }}
# - name: Install Anaconda + Dependencies
# shell: powershell
# run: |
# conda install anaconda
# pip install jupyter-book
# pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx_tojupyter
# - name: Build Lectures (+ Execution Checks)
# shell: powershell
# run: jb build lectures --path-output=./ -W --keep-going
# - name: Upload Execution Reports
# uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: execution-reports
# path: _build/html/reports
44 changes: 44 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Link Checker [Anaconda, Linux]
on:
pull_request:
types: [opened, reopened]
schedule:
# UTC 12:00 is early morning in Australia
- cron: '0 12 * * *'
jobs:
link-check-linux:
name: Link Checking (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Anaconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: '3.11'
environment-file: environment.yml
activate-environment: quantecon
- name: Download "build" folder (cache)
uses: dawidd6/action-download-artifact@v2
with:
workflow: cache.yml
branch: main
name: build-cache
path: _build
- name: Link Checker
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
if: failure()
with:
name: linkcheck-reports
path: _build/linkcheck
Loading

0 comments on commit ba98b79

Please sign in to comment.