Skip to content

Commit

Permalink
build: install ollama
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 14, 2024
1 parent 4f4b80c commit 850b942
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 107 deletions.
130 changes: 67 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,72 @@ name: Build
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.12", "3.13"]
test:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.12", "3.13"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Install dependencies
run: |
uv sync --all-extras
- name: Lint and typecheck
run: |
uv run ruff check .
uv run ruff format --check .
uv run mypy mknodes/
- name: Test
run: |
uv run pytest --cov-report=xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Serve Ollama Model
uses: phil65/ollama-github-action@v1
with:
model: "smollm2:360m"
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Install dependencies
run: |
uv sync --all-extras
- name: Lint and typecheck
run: |
uv run ruff check .
uv run ruff format --check .
uv run mypy mknodes/
- name: Test
run: |
uv run pytest --cov-report=xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

release:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Build
run: |
uv build
- name: Publish on PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
run: |
uv publish
- name: Create release
uses: ncipollo/release-action@v1
with:
body: ${{ github.event.head_commit.message }}
artifacts: dist/*.whl,dist/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Build
run: |
uv build
- name: Publish on PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
run: |
uv publish
- name: Create release
uses: ncipollo/release-action@v1
with:
body: ${{ github.event.head_commit.message }}
artifacts: dist/*.whl,dist/*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
90 changes: 47 additions & 43 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,63 @@
name: Build documentation

on:
push:
branches:
- main
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Install dependencies
run: |
uv sync --all-extras
- name: Build
run: uv run mknodes build -v
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Serve Ollama Model
uses: phil65/ollama-github-action@v1
with:
model: "smollm2:360m"
- name: Install uv
uses: yezz123/setup-uv@v4
- name: Install dependencies
run: |
uv sync --all-extras
- name: Build
run: uv run mknodes build -v
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion mknodes/templatenodes/mkllm/metadata.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "MkLlm"
[examples.regular]
title = "Regular"
jinja = """
{{ "Write a poem about MkDocs" | MkLlm }}
{{ "Write a poem about MkDocs" | MkLlm(model="ollama/smollm2:360m") }}
"""

# [output.markdown]
Expand Down

0 comments on commit 850b942

Please sign in to comment.