Skip to content

chore(deps): Bump the actions-all group with 5 updates #231

chore(deps): Bump the actions-all group with 5 updates

chore(deps): Bump the actions-all group with 5 updates #231

name: docker-test-args
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'website/**'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- 'website/**'
permissions: read-all
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
protocol:
- oci
- huggingface
- https
steps:
- uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
allowed-endpoints: >
auth.docker.io:443
*.huggingface.co:443
cdn.dl.k8s.io:443
dl.k8s.io:443
download.docker.com:443
gcr.io:443
github.com:443
huggingface.co:443
*.githubusercontent.com:443
production.cloudflare.docker.com:443
proxy.golang.org:443
registry-1.docker.io:443
storage.googleapis.com:443
*.blob.core.windows.net:443
*.azureedge.net:443
*.ubuntu.com:80
developer.download.nvidia.com:443
ghcr.io:443
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# need containerd image store for testing local images
- uses: crazy-max/ghaction-setup-docker@78318f8be53384b971671f27d81f5e72526c102d # v3.3.0
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0
- name: build aikit
run: |
docker buildx build . -t aikit:test \
--load --provenance=false --progress plain \
--cache-from=type=gha,scope=aikit \
--cache-to=type=gha,scope=aikit,mode=max
- name: set url
run: |
if [ "${{ matrix.protocol }}" = "oci" ]; then
echo "MODEL_URL=oci://registry.ollama.ai/library/llama3:8b" >> $GITHUB_ENV
echo "MODEL_NAME=llama3" >> $GITHUB_ENV
elif [ "${{ matrix.protocol }}" = "huggingface" ]; then
echo "MODEL_URL=huggingface://QuantFactory/Meta-Llama-3-8B-Instruct-GGUF/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf" >> $GITHUB_ENV
echo "MODEL_NAME=Meta-Llama-3-8B-Instruct.Q4_K_M.gguf" >> $GITHUB_ENV
elif [ "${{ matrix.protocol }}" = "https" ]; then
echo "MODEL_URL=https://huggingface.co/QuantFactory/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf" >> $GITHUB_ENV
echo "MODEL_NAME=Meta-Llama-3-8B-Instruct.Q4_K_M.gguf" >> $GITHUB_ENV
fi
- name: build test model
run: |
docker buildx build -t testmodel:test \
--build-arg="model=$MODEL_URL" \
--load --provenance=false --progress plain \
--cache-from=type=gha,scope=testmodel \
--cache-to=type=gha,scope=testmodel,mode=max \
"https://raw.githubusercontent.com/${REPO}/${SOURCE_BRANCH}/test/aikitfile-args.yaml"
env:
REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
# github head ref is only set for pull_request targets
# otherwise, get the github ref name to get the source branch
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
- name: list images
run: docker images
- name: run test model
run: docker run --name testmodel -d -p 8080:8080 testmodel:test
- name: run llama test
run: |
set -e
result=$(curl --fail --retry 10 --retry-all-errors \
http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d "{\"model\": \"${MODEL_NAME}\", \"messages\": [{\"role\": \"user\", \"content\": \"explain kubernetes in a sentence\"}]}")
echo $result
choices=$(echo "$result" | jq '.choices')
if [ -z "$choices" ]; then
exit 1
fi
- name: save logs
if: always()
run: docker logs testmodel > /tmp/docker-${{ matrix.protocol }}.log
- name: publish test artifacts
if: always()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: test-${{ matrix.protocol }}
path: |
/tmp/*.log