Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed May 7, 2024
1 parent 6b7563e commit cf9f36a
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
test-convertanything:
uses: devxt-llc/ezlocalai/.github/workflows/test-with-ezlocalai.yml@main
uses: ./.github/workflows/test-with-ezlocalai.yml
with:
image: joshxt/ezlocalai:main
additional-python-dependencies: pydantic
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/test-with-ezlocalai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Test with ezLocalai
on:
workflow_call:
inputs:
notebook:
type: string
required: true
description: file to run (ending in .ipynb), can be directory to batch run (without trailing slash)
default: "tests.ipynb"
image:
type: string
required: true
image-options:
type: string
description: like --entrypoint, --command
additional-python-dependencies:
type: string
description: add whatever pip you need here
allow-errors:
type: boolean
description: Fail if there is an error in the execution of the notebook
default: false
additional-args:
type: string
description: additional args for nbconvert
default: "--log-level DEBUG"
append-logs:
type: boolean
default: false
clone-repo:
type: boolean
default: true
secrets:
api-key:
description: Optional api-key available as os.getenv('API_KEY') in your notebook

jobs:
jupyter-test-job:
runs-on: ubuntu-latest
outputs:
digest: ${{ steps.dockerBuild.outputs.digest }}
services:
service-under-test:
image: ${{ inputs.image }}
env:
DEFAULT_MODEL: "MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF"
ports:
- 8091:8091

steps:
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1

- name: Install jupyter
run: pip3 install jupyter nbconvert[webpdf]
- name: Update package lists and install jupyter output generation dependencies
run: |
sudo apt-get update
sudo apt-get install --fix-missing -y pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic
- name: Clone repository and install package
if: inputs.clone-repo
run: |
git clone https://github.com/${{ github.repository }} /tmp/repo
cd /tmp/repo
pip3 install .
- name: Install additional dependencies for notebooks
if: inputs.additional-python-dependencies
run: pip3 install requests ${{ inputs.additional-python-dependencies }}

- name: Set notebook and artifact files
run: |
notebook="${{ inputs.notebook }}"
if ${{ endsWith( inputs.notebook, 'ipynb' ) }} ; then
echo "notebook-file=${notebook}" >> "$GITHUB_ENV"
echo "artifact-file=${notebook%.*}.pdf" >> "$GITHUB_ENV"
else
echo "notebook-file=${notebook}/*.ipynb" >> "$GITHUB_ENV"
echo "artifact-file=${notebook}/*.pdf" >> "$GITHUB_ENV"
fi
- name: Configure nbconvert args
run: echo "nbconvert-args=--execute ${{ inputs.additional-args }} --to pdf" >> "$GITHUB_ENV"

- name: Enable switch --allow-errors
if: inputs.allow-errors
run: echo "nbconvert-args=${{ env.nbconvert-args }} --allow-errors"

- name: Add additional nbconvert args
if: inputs.additional-args
run: echo "nbconvert-args=${{ env.nbconvert-args }} ${{ inputs.additional-args }}"

- name: Execute notebook
env:
API_KEY: ${{ secrets.api-key }}
run: python3 -m nbconvert ${{ env.nbconvert-args }} ${{ env.notebook-file }}

- name: Append test logs
if: inputs.append-logs
run: |
docker logs "${{ job.services.agixt.id }}" > /test-output.log
- name: Append test logs
if: inputs.append-logs
run: |
echo "artifact-file=${{ env.artifact-file }}\n/test-output.log" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: test-reports
path: ${{ env.artifact-file }}

0 comments on commit cf9f36a

Please sign in to comment.