-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |