Skip to content

Commit

Permalink
deptry and sphinx for uv
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Nov 29, 2024
1 parent 69a318b commit c910c64
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actions/uv/deptry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
runs:
using: "composite"
steps:
- uses: cvxgrp/.github/actions/setup-environment-uv@main
- uses: cvxgrp/.github/actions/uv/setup@main

- name: Install deptry
shell: bash
Expand Down
60 changes: 60 additions & 0 deletions actions/uv/jupyter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2023 Stanford University Convex Optimization Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build the Jupyter Book

description: "Build jupyter book"

on:
workflow_call:
inputs:
kernel:
description: 'Jupyter kernel'
type: string
required: false
default: 'cvx'

runs:
using: "composite"

steps:
#- name: Check out repository
#- uses: actions/checkout@v4

- uses: cvxgrp/.github/actions/uv/setup@main

- name: Install jupyterbook
shell: bash
run: |
uv pip install jupyter-book
# There is no need to create the kernel if the jupyter book is installed within the same virtual environment as the package
# poetry run python -m ipykernel install --user --name=${{ inputs.kernel || 'cvx' }}
# Build the book
- name: Build the book
shell: bash
run: |
uv run jupyter-book clean book
uv run jupyter-book build book
# Create this weird .nojekyll file
# We do this in the book action... This is the wrong place
# see https://jupyterbook.org/en/stable/publish/gh-pages.html#option-1-copy-and-paste-your-books-build-contents-into-a-new-folder
# touch book/_build/html/.nojekyll
# Upload the book
- name: Archive book
uses: actions/upload-artifact@v4
with:
name: book
path: book/_build/html/
retention-days: 1
44 changes: 44 additions & 0 deletions actions/uv/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2023 Stanford University Convex Optimization Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Setup the Python Environment

description: "Construct a Python environment for ci/cd using uv"

on:
workflow_call:
inputs:
python-version:
description: 'Python version'
type: string
required: false
default: '3.12'

runs:
using: "composite"
steps:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
# Install a specific version of uv.
version: "0.5.4"

- name: Set up Python ${{ inputs.python-version || '3.12' }}
shell: bash
run: |
uv python install ${{ inputs.python-version || '3.12' }}
- name: Install the project
shell: bash
run: |
uv sync --all-extras --dev
2 changes: 1 addition & 1 deletion actions/uv/sphinx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
using: "composite"

steps:
- uses: cvxgrp/.github/actions/setup-environment-uv@main
- uses: cvxgrp/.github/actions/uv/setup@main

- name: Install sphinx
shell: bash
Expand Down

0 comments on commit c910c64

Please sign in to comment.