Skip to content

Commit 4e99e50

Browse files
committed
Initial commit: Test repository cloned from lecture-python-intro
0 parents  commit 4e99e50

File tree

123 files changed

+101647
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+101647
-0
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
enable-beta-ecosystems: true
8+
updates:
9+
- package-ecosystem: github-actions
10+
directory: /
11+
commit-message:
12+
prefix: ⬆️
13+
schedule:
14+
interval: weekly
15+
- package-ecosystem: "conda"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"

.github/workflows/cache.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build Cache [using jupyter-book]
2+
on:
3+
schedule:
4+
# Execute cache weekly at 3am on Monday
5+
- cron: '0 3 * * 1'
6+
workflow_dispatch:
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v5
13+
- name: Setup Anaconda
14+
uses: conda-incubator/setup-miniconda@v3
15+
with:
16+
auto-update-conda: true
17+
auto-activate-base: true
18+
miniconda-version: 'latest'
19+
python-version: "3.13"
20+
environment-file: environment.yml
21+
activate-environment: quantecon
22+
- name: graphviz Support # TODO: required?
23+
run: |
24+
sudo apt-get -qq update && sudo apt-get install -y graphviz
25+
- name: Install latex dependencies
26+
run: |
27+
sudo apt-get -qq update
28+
sudo apt-get install -y \
29+
texlive-latex-recommended \
30+
texlive-latex-extra \
31+
texlive-fonts-recommended \
32+
texlive-fonts-extra \
33+
texlive-xetex \
34+
latexmk \
35+
xindy \
36+
dvipng \
37+
cm-super
38+
- name: Build HTML
39+
shell: bash -l {0}
40+
run: |
41+
jb build lectures --path-output ./ -W --keep-going
42+
- name: Upload Execution Reports (HTML)
43+
uses: actions/upload-artifact@v5
44+
if: failure()
45+
with:
46+
name: execution-reports
47+
path: _build/html/reports
48+
- name: Upload "_build" folder (cache)
49+
uses: actions/upload-artifact@v5
50+
with:
51+
name: build-cache
52+
path: _build
53+
include-hidden-files: true

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build HTML [using jupyter-book]
2+
on: [pull_request]
3+
jobs:
4+
preview:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v5
9+
- name: Setup Anaconda
10+
uses: conda-incubator/setup-miniconda@v3
11+
with:
12+
auto-update-conda: true
13+
auto-activate-base: true
14+
miniconda-version: 'latest'
15+
python-version: "3.13"
16+
environment-file: environment.yml
17+
activate-environment: quantecon
18+
- name: Graphics Support #TODO: Review if graphviz is needed
19+
run: |
20+
sudo apt-get -qq update && sudo apt-get install -y graphviz
21+
- name: Install latex dependencies
22+
run: |
23+
sudo apt-get -qq update
24+
sudo apt-get install -y \
25+
texlive-latex-recommended \
26+
texlive-latex-extra \
27+
texlive-fonts-recommended \
28+
texlive-fonts-extra \
29+
texlive-xetex \
30+
latexmk \
31+
xindy \
32+
dvipng \
33+
cm-super
34+
- name: Display Conda Environment Versions
35+
shell: bash -l {0}
36+
run: conda list
37+
- name: Display Pip Versions
38+
shell: bash -l {0}
39+
run: pip list
40+
- name: Download "build" folder (cache)
41+
uses: dawidd6/action-download-artifact@v11
42+
with:
43+
workflow: cache.yml
44+
branch: main
45+
name: build-cache
46+
path: _build
47+
# Build Assets (Download Notebooks and PDF via LaTeX)
48+
- name: Build PDF from LaTeX
49+
shell: bash -l {0}
50+
run: |
51+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
52+
mkdir -p _build/html/_pdf
53+
cp -u _build/latex/*.pdf _build/html/_pdf
54+
- name: Upload Execution Reports (LaTeX)
55+
uses: actions/upload-artifact@v5
56+
if: failure()
57+
with:
58+
name: execution-reports
59+
path: _build/latex/reports
60+
- name: Build Download Notebooks (sphinx-tojupyter)
61+
shell: bash -l {0}
62+
run: |
63+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
64+
mkdir -p _build/html/_notebooks
65+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
66+
# Build HTML (Website)
67+
# BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes
68+
# and clear the sphinx cache for building final HTML documents.
69+
- name: Build HTML
70+
shell: bash -l {0}
71+
run: |
72+
rm -r _build/.doctrees
73+
jb build lectures --path-output ./ -nW --keep-going
74+
- name: Upload Execution Reports (HTML)
75+
uses: actions/upload-artifact@v5
76+
if: failure()
77+
with:
78+
name: execution-reports
79+
path: _build/html/reports
80+
- name: Preview Deploy to Netlify
81+
uses: nwtgck/actions-netlify@v3.0
82+
with:
83+
publish-dir: '_build/html/'
84+
production-branch: main
85+
github-token: ${{ secrets.GITHUB_TOKEN }}
86+
deploy-message: "Preview Deploy from GitHub Actions"
87+
env:
88+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
89+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

.github/workflows/collab.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build Project on Google Collab (Execution)
2+
on: [pull_request]
3+
4+
jobs:
5+
test:
6+
runs-on: quantecon-large
7+
container:
8+
image: us-docker.pkg.dev/colab-images/public/runtime:latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
with:
12+
ref: ${{ github.event.pull_request.head.sha }}
13+
- name: Check for dockerenv file
14+
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
15+
- name: Check python version
16+
shell: bash -l {0}
17+
run: |
18+
python --version
19+
- name: Display Pip Versions
20+
shell: bash -l {0}
21+
run: pip list
22+
- name: Download "build" folder (cache)
23+
uses: dawidd6/action-download-artifact@v11
24+
with:
25+
workflow: cache.yml
26+
branch: main
27+
name: build-cache
28+
path: _build
29+
# Install build software
30+
- name: Install Build Software
31+
shell: bash -l {0}
32+
run: |
33+
pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.2.0 sphinx_reredirects==0.1.3
34+
# Build of HTML (Execution Testing)
35+
- name: Build HTML
36+
shell: bash -l {0}
37+
run: |
38+
jb build lectures --path-output ./ -n -W --keep-going
39+
- name: Upload Execution Reports
40+
uses: actions/upload-artifact@v5
41+
if: failure()
42+
with:
43+
name: execution-reports
44+
path: _build/html/reports
45+
- name: Preview Deploy to Netlify
46+
uses: nwtgck/actions-netlify@v3.0
47+
with:
48+
publish-dir: '_build/html/'
49+
production-branch: main
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
deploy-message: "Preview Deploy from GitHub Actions"
52+
env:
53+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
54+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

.github/workflows/linkcheck.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Link Checker [Anaconda, Linux]
2+
on:
3+
schedule:
4+
# UTC 23:00 is early morning in Australia (9am) -- runs weekly on Sunday
5+
- cron: '0 23 * * 0'
6+
workflow_dispatch:
7+
jobs:
8+
link-checking:
9+
name: Link Checking
10+
runs-on: "ubuntu-latest"
11+
permissions:
12+
issues: write # required for peter-evans/create-issue-from-file
13+
steps:
14+
# Checkout the live site (html)
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
with:
18+
ref: gh-pages
19+
- name: Link Checker
20+
id: lychee
21+
uses: lycheeverse/lychee-action@v2
22+
with:
23+
fail: false
24+
args: --accept 403,503 *.html
25+
- name: Create Issue From File
26+
if: steps.lychee.outputs.exit_code != 0
27+
uses: peter-evans/create-issue-from-file@v6
28+
with:
29+
title: Link Checker Report
30+
content-filepath: ./lychee/out.md
31+
labels: report, automated issue, linkchecker

.github/workflows/publish.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Build & Publish to GH-PAGES
2+
on:
3+
push:
4+
tags:
5+
- 'publish*'
6+
jobs:
7+
publish:
8+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v5
13+
- name: Setup Anaconda
14+
uses: conda-incubator/setup-miniconda@v3
15+
with:
16+
auto-update-conda: true
17+
auto-activate-base: true
18+
miniconda-version: 'latest'
19+
python-version: "3.13"
20+
environment-file: environment.yml
21+
activate-environment: quantecon
22+
- name: Install latex dependencies
23+
run: |
24+
sudo apt-get -qq update
25+
sudo apt-get install -y \
26+
texlive-latex-recommended \
27+
texlive-latex-extra \
28+
texlive-fonts-recommended \
29+
texlive-fonts-extra \
30+
texlive-xetex \
31+
latexmk \
32+
xindy \
33+
dvipng \
34+
cm-super
35+
- name: Display Conda Environment Versions
36+
shell: bash -l {0}
37+
run: conda list
38+
- name: Display Pip Versions
39+
shell: bash -l {0}
40+
run: pip list
41+
- name: Download "build" folder (cache)
42+
uses: dawidd6/action-download-artifact@v11
43+
with:
44+
workflow: cache.yml
45+
branch: main
46+
name: build-cache
47+
path: _build
48+
# Build Assets (Download Notebooks and PDF via LaTeX)
49+
- name: Build PDF from LaTeX
50+
shell: bash -l {0}
51+
run: |
52+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
53+
- name: Copy LaTeX PDF for GH-PAGES
54+
shell: bash -l {0}
55+
run: |
56+
mkdir -p _build/html/_pdf
57+
cp -u _build/latex/*.pdf _build/html/_pdf
58+
- name: Build Download Notebooks (sphinx-tojupyter)
59+
shell: bash -l {0}
60+
run: |
61+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
62+
- name: Copy Download Notebooks for GH-PAGES
63+
shell: bash -l {0}
64+
run: |
65+
mkdir -p _build/html/_notebooks
66+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
67+
# Build HTML (Website)
68+
# BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes
69+
# and clear the sphinx cache for building final HTML documents.
70+
- name: Build HTML
71+
shell: bash -l {0}
72+
run: |
73+
rm -r _build/.doctrees
74+
jb build lectures --path-output ./
75+
# Create HTML archive for release assets
76+
- name: Create HTML archive
77+
shell: bash -l {0}
78+
run: |
79+
tar -czf lecture-python-intro-html-${{ github.ref_name }}.tar.gz -C _build/html .
80+
sha256sum lecture-python-intro-html-${{ github.ref_name }}.tar.gz > html-checksum.txt
81+
82+
# Create metadata manifest
83+
cat > html-manifest.json << EOF
84+
{
85+
"tag": "${{ github.ref_name }}",
86+
"commit": "${{ github.sha }}",
87+
"timestamp": "$(date -Iseconds)",
88+
"size_mb": $(du -sm _build/html | cut -f1),
89+
"file_count": $(find _build/html -type f | wc -l)
90+
}
91+
EOF
92+
- name: Upload archives to release
93+
uses: softprops/action-gh-release@v1
94+
with:
95+
files: |
96+
lecture-python-intro-html-${{ github.ref_name }}.tar.gz
97+
html-checksum.txt
98+
html-manifest.json
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
- name: Deploy to Netlify
102+
uses: nwtgck/actions-netlify@v3.0
103+
with:
104+
publish-dir: '_build/html/'
105+
production-branch: main
106+
github-token: ${{ secrets.GITHUB_TOKEN }}
107+
deploy-message: "Deploy from GitHub Actions"
108+
env:
109+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
110+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
111+
- name: Deploy website to gh-pages
112+
uses: peaceiris/actions-gh-pages@v4
113+
with:
114+
github_token: ${{ secrets.GITHUB_TOKEN }}
115+
publish_dir: _build/html/
116+
cname: intro.quantecon.org
117+
- name: Upload "_build" folder (cache)
118+
uses: actions/upload-artifact@v5
119+
with:
120+
name: build-publish
121+
path: _build
122+
# Sync notebooks
123+
- name: Prepare lecture-python-intro.notebooks sync
124+
shell: bash -l {0}
125+
run: |
126+
mkdir -p _build/lecture-python-intro.notebooks
127+
cp -a _notebook_repo/. _build/lecture-python-intro.notebooks
128+
cp _build/jupyter/*.ipynb _build/lecture-python-intro.notebooks
129+
ls -a _build/lecture-python-intro.notebooks
130+
- name: Commit latest notebooks to lecture-python-intro.notebooks
131+
uses: cpina/github-action-push-to-another-repository@main
132+
env:
133+
API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }}
134+
with:
135+
source-directory: '_build/lecture-python-intro.notebooks/'
136+
destination-repository-username: 'QuantEcon'
137+
destination-repository-name: 'lecture-python-intro.notebooks'
138+
commit-message: 'auto publishing updates to notebooks'
139+
destination-github-username: 'quantecon-services'
140+
user-email: services@quantecon.org

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
lectures/_build
3+
.ipynb_checkpoints/
4+
.virtual_documents/
5+
_build/*

0 commit comments

Comments
 (0)