-
-
Notifications
You must be signed in to change notification settings - Fork 15
121 lines (108 loc) · 3.91 KB
/
test-with-ezlocalai.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Test with ezlocalai
on:
workflow_call:
inputs:
notebook:
type: string
description: file to run (ending in .ipynb), can be directory to batch run (without trailing slash)
default: "tests.ipynb"
image:
type: string
default: joshxt/ezlocalai:main
port:
type: string
default: "8091"
port-mapping:
type: string
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:
- ${{ inputs.port-mapping || format('{0}:{1}', inputs.port, inputs.port) }}
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 }}