diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eef986f..99561bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,39 +1,36 @@ -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 @@ -41,50 +38,41 @@ jobs: 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 diff --git a/.github/workflows/execution.yml b/.github/workflows/execution.yml deleted file mode 100644 index f36dfbb..0000000 --- a/.github/workflows/execution.yml +++ /dev/null @@ -1,111 +0,0 @@ -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 diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 5451804..677a196 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -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 }}) @@ -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 @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2a12516..938b8e5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,64 +1,55 @@ -name: Build & Publish to GH Pages +name: Build & Publish to GH-PAGES on: push: tags: - 'publish*' 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 publish: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - 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 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Install Git (required to commit notebooks) - shell: bash -l {0} - run: apt-get install -y git - - name: Check nvidia drivers - shell: bash -l {0} + uses: actions/checkout@v4 + - name: Setup Anaconda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + auto-activate-base: true + miniconda-version: 'latest' + python-version: "3.11" + environment-file: environment.yml + activate-environment: quantecon + - name: Install latex dependencies run: | - nvidia-smi + 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 - # Download Build Cache from cache.yml - 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, PDF via LaTeX) + # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0} run: | - jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going + jb build lectures --builder pdflatex --path-output ./ -n --keep-going - name: Copy LaTeX PDF for GH-PAGES shell: bash -l {0} run: | @@ -67,47 +58,57 @@ jobs: - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | - jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going - zip -r download-notebooks.zip _build/jupyter - - uses: actions/upload-artifact@v2 - with: - name: download-notebooks - path: download-notebooks.zip + jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter - name: Copy Download Notebooks for GH-PAGES shell: bash -l {0} run: | mkdir -p _build/html/_notebooks cp -u _build/jupyter/*.ipynb _build/html/_notebooks - # Final Build of HTML (with assets) + # 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 ./ + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2 + with: + publish-dir: '_build/html/' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - name: Deploy website to gh-pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: _build/html/ - cname: python.quantecon.org - - name: Prepare lecture-python.notebooks sync + # cname: eqm.quantecon.org + - name: Upload "_build" folder (cache) + uses: actions/upload-artifact@v4 + with: + name: build-publish + path: _build + # Sync notebooks + - name: Prepare lecture-eqm.notebooks sync shell: bash -l {0} run: | - mkdir -p _build/lecture-python.notebooks - cp -a _notebook_repo/. _build/lecture-python.notebooks - cp _build/jupyter/*.ipynb _build/lecture-python.notebooks - ls -a _build/lecture-python.notebooks - - name: Commit notebooks to lecture-python.notebooks - shell: bash -l {0} + mkdir -p _build/lecture-eqm.notebooks + cp -a _notebook_repo/. _build/lecture-eqm.notebooks + cp _build/jupyter/*.ipynb _build/lecture-eqm.notebooks + ls -a _build/lecture-eqm.notebooks + - name: Commit latest notebooks to lecture-eqm.notebooks + uses: cpina/github-action-push-to-another-repository@main env: - QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }} - run: | - git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-python.notebooks - - cp _build/lecture-python.notebooks/*.ipynb lecture-python.notebooks - - cd lecture-python.notebooks - git config user.name "QuantEcon Services" - git config user.email "admin@quantecon.org" - git add *.ipynb - git commit -m "auto publishing updates to notebooks" - git push origin master + API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }} + with: + source-directory: '_build/lecture-eqm.notebooks/' + destination-repository-username: 'QuantEcon' + destination-repository-name: 'lecture-eqm.notebooks' + commit-message: 'auto publishing updates to notebooks' + destination-github-username: 'quantecon-services' + user-email: services@quantecon.org diff --git a/lectures/_config.yml b/lectures/_config.yml index 35082e8..6e8dc09 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -24,12 +24,12 @@ execute: bibtex_bibfiles: - _static/quant-econ.bib -html: - baseurl: https://python.quantecon.org/ +# html: +# baseurl: https://eqm.quantecon.org/ latex: latex_documents: - targetname: quantecon-python.tex + targetname: quantecon-eqm.tex sphinx: extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter, sphinxcontrib.youtube, sphinx.ext.todo, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx, sphinx_reredirects] @@ -81,8 +81,8 @@ sphinx: url: https://johnstachurski.net/ header_organisation_url: https://quantecon.org header_organisation: QuantEcon - repository_url: https://github.com/QuantEcon/lecture-python.myst - nb_repository_url: https://github.com/QuantEcon/lecture-python.notebooks + repository_url: https://github.com/QuantEcon/lecture-eqm + nb_repository_url: https://github.com/QuantEcon/lecture-eqm.notebooks twitter: quantecon twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png @@ -117,8 +117,8 @@ sphinx: heavy_tails: https://intro.quantecon.org/heavy_tails.html tojupyter_static_file_path: ["source/_static", "_static"] tojupyter_target_html: true - tojupyter_urlpath: "https://python.quantecon.org/" - tojupyter_image_urlpath: "https://python.quantecon.org/_static/" + tojupyter_urlpath: "https://eqm.quantecon.org/" + tojupyter_image_urlpath: "https://eqm.quantecon.org/_static/" tojupyter_lang_synonyms: ["ipython", "ipython3", "python"] tojupyter_kernels: python3: diff --git a/lectures/status.md b/lectures/status.md index 8309f51..24b489c 100644 --- a/lectures/status.md +++ b/lectures/status.md @@ -18,6 +18,5 @@ This table contains the latest execution statistics. (status:machine-details)= -These lectures are built on `linux` instances through `github actions` and `amazon web services (aws)` to -enable access to a `gpu`. These lectures are built on a [p3.2xlarge](https://aws.amazon.com/ec2/instance-types/p3/) -that has access to `8 vcpu's`, a `V100 NVIDIA Tesla GPU`, and `61 Gb` of memory. \ No newline at end of file +These lectures are built on `linux` instances through `github actions` so are +executed using the following [hardware specifications](https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources) \ No newline at end of file