Skip to content

Commit 1cbdbe1

Browse files
Switch to uv and Quarto in GHA workflow
1 parent f6e2e6c commit 1cbdbe1

File tree

4 files changed

+1405
-56
lines changed

4 files changed

+1405
-56
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,45 @@ on:
99

1010
# This job installs dependencies, build the book, and pushes it to `gh-pages`
1111
jobs:
12+
render-knitr-quarto:
13+
uses: ./.github/workflows/render-knitr-quarto.yml
14+
1215
deploy-book:
1316
runs-on: ubuntu-latest
17+
needs: render-knitr-quarto
18+
1419
steps:
1520
- uses: actions/checkout@v4
1621

1722
# Install dependencies
18-
- name: Set up Python 3.10
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: "3.10"
22-
23-
- name: cache installation
24-
uses: actions/cache@v3
25-
with:
26-
path: ${{ env.pythonLocation }}
27-
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
23+
- name: Set up Quarto
24+
uses: quarto-dev/quarto-actions/setup@v2
2825

29-
- name: Install dependencies
30-
run: |
31-
pip install -r requirements.txt
32-
# Build the book
33-
- name: Build the book
34-
run: |
35-
jupyter-book build .
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v6
3628

37-
# Push the book's HTML to github-pages
38-
- name: GitHub Pages action
39-
uses: peaceiris/actions-gh-pages@v4
40-
if: ${{ github.ref == 'refs/heads/main' }}
29+
# GitHub caches Python versions with the runner thus likely faster than uv
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
4132
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
publish_dir: ./_build/html
44-
45-
# # Push to CS server
46-
# - name: rsync and ssh to CS
47-
# env:
48-
# COURSE_REMOTE_HOST: kunghit.students.cs.ubc.ca
49-
# COURSE_REMOTE_USER: cs-330
50-
# CS_REMOTE_USER: firasm
51-
# CS_TUNNEL: remote.cs.ubc.ca
52-
# REMOTE_KEY: ${{ secrets.FIRAS_SERVER_SSH_KEY }}
53-
# FIRAS_KEYBOARDMBP: ${{ secrets.FIRAS_KEYBOARDMBP }}
54-
# TERM: 2024_W1
55-
# LOCAL_DIR: _build/html/
56-
# run: |
57-
# mkdir -p ~/.ssh
58-
# echo "$REMOTE_KEY" > ~/.ssh/id_rsa
59-
# chmod 600 ~/.ssh/id_rsa
60-
# ssh-keyscan -H $CS_TUNNEL >> ~/.ssh/known_hosts
61-
62-
# echo "$FIRAS_KEYBOARDMBP" > ~/.ssh/id_ed25519
63-
# chmod 600 ~/.ssh/id_ed25519
64-
65-
# # Set up a tunnel in the background
66-
# ssh -fN -L 2222:$COURSE_REMOTE_HOST:22 $CS_REMOTE_USER@$CS_TUNNEL -p 22
67-
68-
# # send files all in one shot
69-
# rsync -avzr -e 'ssh -p 22 -o StrictHostKeyChecking=no -J $CS_REMOTE_USER@$CS_TUNNEL' $LOCAL_DIR $COURSE_REMOTE_USER@$COURSE_REMOTE_HOST:public_html/$TERM
70-
33+
python-version-file: "pyproject.toml"
34+
35+
- name: Install Python dependencies
36+
run: uv sync --locked --all-extras
37+
38+
- name: Install R
39+
uses: r-lib/actions/setup-r@v2
40+
with:
41+
r-version: '4.2.0'
42+
43+
- name: Install R Dependencies
44+
uses: r-lib/actions/setup-renv@v2
45+
with:
46+
cache-version: 1
47+
48+
- name: Render and Publish Quarto project
49+
uses: quarto-dev/quarto-actions/publish@v2
50+
with:
51+
target: gh-pages
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "cpsc203"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"jupyter>=1.1.1",
9+
"numpy>=2.3.1",
10+
]

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)