Skip to content

Commit e3aca15

Browse files
committed
update main CI and test it with pull request preview
1 parent 158e411 commit e3aca15

File tree

1 file changed

+37
-56
lines changed

1 file changed

+37
-56
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,51 @@ jobs:
44
preview:
55
runs-on: ubuntu-latest
66
steps:
7+
steps:
78
- uses: actions/checkout@v4
8-
- name: Setup Anaconda
9-
uses: conda-incubator/setup-miniconda@v3
9+
10+
- name: Setup GitHub Pages
11+
uses: actions/configure-pages@v3
12+
13+
- name: Cache Notebook Execution
14+
uses: actions/cache@v3
15+
id: cache-execution
1016
with:
11-
auto-update-conda: true
12-
auto-activate-base: true
13-
miniconda-version: 'latest'
14-
python-version: "3.12"
15-
environment-file: environment.yml
16-
activate-environment: quantecon
17-
- name: Install latex dependencies
18-
run: |
19-
sudo apt-get -qq update
20-
sudo apt-get install -y \
21-
texlive-latex-recommended \
22-
texlive-latex-extra \
23-
texlive-fonts-recommended \
24-
texlive-fonts-extra \
25-
texlive-xetex \
26-
latexmk \
27-
xindy \
28-
dvipng \
29-
cm-super
30-
- name: Display Conda Environment Versions
31-
shell: bash -l {0}
32-
run: conda list
33-
- name: Display Pip Versions
34-
shell: bash -l {0}
35-
run: pip list
36-
- name: Download "build" folder (cache)
37-
uses: dawidd6/action-download-artifact@v9
17+
path: ./lectures/_build/execute
18+
key: ${{ runner.os }}-execute-cache-${{ hashFiles('lectures/**/*.md') }}
19+
20+
- uses: actions/setup-node@v4
3821
with:
39-
workflow: cache.yml
40-
branch: main
41-
name: build-cache
42-
path: _build
43-
# Build Assets (Download Notebooks and PDF via LaTeX)
44-
- name: Build Download Notebooks (sphinx-tojupyter)
45-
shell: bash -l {0}
46-
run: |
47-
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
48-
mkdir -p _build/html/_notebooks
49-
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
50-
- name: Build PDF from LaTeX
51-
shell: bash -l {0}
52-
run: |
53-
jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going
54-
mkdir _build/html/_pdf
55-
cp -u _build/latex/*.pdf _build/html/_pdf
56-
# Final Build of HTML
22+
node-version: 18.x
23+
24+
- name: Install Python
25+
if: steps.cache-execution.outputs.cache-hit != 'true'
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
cache: 'pip'
30+
cache-dependency-path: 'myst_requirements.txt'
31+
32+
- name: Install execution requirements
33+
if: steps.cache-execution.outputs.cache-hit != 'true'
34+
run: python -m pip install -r myst_requirements.txt
35+
36+
- name: Install MyST Markdown CLI
37+
run: npm install -g mystmd
38+
5739
- name: Build HTML
58-
shell: bash -l {0}
59-
run: |
60-
jb build lectures --path-output ./ -n -W --keep-going
61-
- name: Upload Execution Reports
62-
uses: actions/upload-artifact@v4
63-
if: failure()
40+
working-directory: ./lectures
41+
run: myst build --html --execute
42+
43+
- name: Upload build output
44+
uses: actions/upload-pages-artifact@v3
6445
with:
65-
name: execution-reports
66-
path: _build/html/reports
46+
path: './lectures/_build/html'
47+
6748
- name: Preview Deploy to Netlify
6849
uses: nwtgck/actions-netlify@v3
6950
with:
70-
publish-dir: '_build/html/'
51+
publish-dir: './lectures/_build/html'
7152
production-branch: main
7253
github-token: ${{ secrets.GITHUB_TOKEN }}
7354
deploy-message: "Preview Deploy from GitHub Actions"

0 commit comments

Comments
 (0)