Skip to content

Commit

Permalink
working on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mtln committed Oct 24, 2024
1 parent f4b8431 commit 1dfad43
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/quarto-ghp-action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 'build-docs'
description: 'Create docs with nbdev'
inputs:
pre:
description: 'Install prerelease nbdev/execnb from master?'
required: false
default: ''
version:
description: 'Version of python to set up'
required: false
default: '3.10'
ghtoken:
description: 'GitHub token'
default: ${{ github.token }}
required: false
publish_branch:
description: 'Branch name to publish docs to'
required: false
default: 'gh-pages'
torch_cpu:
description: "Install PyTorch CPU instead of PyTorch Cuda. Has no effect if PyTorch isn't a requirement. Enabled by defaut."
required: false
default: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.version }}
cache: "pip"
cache-dependency-path: settings.ini
- name: Install Dependencies
env:
USE_PRE: ${{ inputs.pre }}
TORCH_CPU: "${{ inputs.torch_cpu }}"
shell: bash
run: |
set -ux
python -m pip install --upgrade pip
if [ $USE_PRE ]; then
pip install -Uq git+https://github.com/fastai/ghapi.git
pip install -Uq git+https://github.com/fastai/fastcore.git
pip install -Uq git+https://github.com/fastai/execnb.git
pip install -Uq git+https://github.com/fastai/nbdev.git
wget -q $(curl https://latest.fast.ai/pre/quarto-dev/quarto-cli/linux-amd64.deb)
sudo dpkg -i quarto*.deb
else
pip install -Uq nbdev
fi
if [ $TORCH_CPU ]; then
test -f setup.py && pip install -e ".[dev]" --extra-index-url https://download.pytorch.org/whl/cpu
else
test -f setup.py && pip install -e ".[dev]"
fi
nbdev_docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ inputs.ghtoken }}
force_orphan: true
publish_dir: ./_docs
# The following lines assign commit authorship to the official GH-Actions bot for deploys to `gh-pages` branch.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
publish_branch: ${{ inputs.publish_branch }}
7 changes: 6 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ on: [workflow_dispatch, pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
steps: [uses: fastai/workflows/nbdev-ci@master]
steps:
- uses: actions/checkout@v3 # Ensure the repo is checked out first

# Run your local action file
- name: Run local Quarto GHP Action
uses: ./path/to/quarto-ghp-action.yaml

0 comments on commit 1dfad43

Please sign in to comment.