Skip to content

Commit

Permalink
Merge pull request #247 from sallyom/tests
Browse files Browse the repository at this point in the history
enable tests for sample apps
  • Loading branch information
rhatdan authored Apr 12, 2024
2 parents 9c17467 + 6fbfd23 commit 3734eae
Show file tree
Hide file tree
Showing 38 changed files with 670 additions and 255 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Update quay.io/ai-lab images
name: Update quay.io/ai-lab images with manual trigger

on:
schedule: # schedule the job to run at 12 AM daily
- cron: '0 0 * * *'

workflow_dispatch:

env:
Expand Down
172 changes: 0 additions & 172 deletions .github/workflows/build-images.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/chatbot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
pull_request:
branches:
- main
# paths:
# - ./recipes/natural_language_processing/chatbot/**
# - .github/workflows/chatbot.yaml
paths:
- ./recipes/natural_language_processing/chatbot/**
- .github/workflows/chatbot.yaml
push:
branches:
- main
# paths:
# - ./recipes/natural_language_processing/chatbot/**
# - .github/workflows/chatbot.yaml
paths:
- ./recipes/natural_language_processing/chatbot/**
- .github/workflows/chatbot.yaml

workflow_dispatch:

Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/codegen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: codegen

on:
pull_request:
branches:
- main
paths:
- ./recipes/natural_language_processing/codegen/**
- .github/workflows/codegen.yaml
push:
branches:
- main
paths:
- ./recipes/natural_language_processing/codegen/**
- .github/workflows/codegen.yaml

workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: codegen

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
services:
registry:
image: registry:2.8.3
ports:
- 5000:5000
steps:
- uses: actions/checkout@v4.1.1

- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2.13
with:
image: ${{ env.REGISTRY }}/containers/${{ env.IMAGE_NAME }}
tags: latest
platforms: linux/amd64, linux/arm64
containerfiles: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app/Containerfile
context: recipes/natural_language_processing/${{ env.IMAGE_NAME }}/app

- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: '3.11'

- name: Install Dependencies
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}
run: make install

- name: Download model
working-directory: ./model_servers/llamacpp_python
run: make mistral

- name: Run Functional Tests
shell: bash
run: make functional-tests
working-directory: ./recipes/natural_language_processing/${{ env.IMAGE_NAME }}

- name: Login to Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1.7
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Image
id: push_image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/push-to-registry@v2.8
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.REGISTRY }}
59 changes: 46 additions & 13 deletions .github/workflows/model_servers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
pull_request:
branches:
- main
# paths:
# - ./model_servers/
# - .github/workflows/model_servers.yaml
paths:
- ./model_servers/
- .github/workflows/model_servers.yaml
push:
branches:
- main
# paths:
# - ./model_servers/
# - .github/workflows/model_servers.yaml
paths:
- ./model_servers/
- .github/workflows/model_servers.yaml

workflow_dispatch:

Expand All @@ -26,8 +26,28 @@ jobs:
include:
- image_name: llamacpp_python
model: mistral
flavor: base
directory: llamacpp_python
platforms: linux/amd64,linux/arm64
no_gpu: 1
#- image_name: llamacpp_python_vulkan
# model: mistral
# flavor: vulkan
# directory: llamacpp_python
# platforms: linux/arm64
# vulkan: 1
- image_name: llamacpp_python_cuda
model: mistral
flavor: cuda
directory: llamacpp_python
platforms: linux/amd64
cuda: 1
- image_name: whispercpp
model: whisper-small
flavor: base
directory: whispercpp
platforms: linux/amd64,linux/arm64
no_gpu: 1
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -38,6 +58,11 @@ jobs:
ports:
- 5000:5000
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4.1.1

- name: Install qemu dependency
Expand All @@ -50,13 +75,13 @@ jobs:
uses: redhat-actions/buildah-build@v2.13
with:
image: ${{ env.REGISTRY }}/${{ github.repository_owner}}/${{ matrix.image_name }}
platforms: linux/amd64, linux/arm64
platforms: ${{ matrix.platforms }}
tags: latest
containerfiles: ./model_servers/${{ matrix.image_name }}/base/Containerfile
context: model_servers/${{ matrix.image_name }}/
containerfiles: ./model_servers/${{ matrix.directory }}/${{ matrix.flavor }}/Containerfile
context: model_servers/${{ matrix.directory }}/

- name: Download model
working-directory: ./model_servers/${{ matrix.image_name }}/
working-directory: ./model_servers/${{ matrix.directory }}/
run: make ${{ matrix.model }}

- name: Set up Python
Expand All @@ -65,15 +90,23 @@ jobs:
python-version: '3.11'

- name: Install python dependencies
working-directory: ./model_servers/${{ matrix.image_name }}/
working-directory: ./model_servers/${{ matrix.directory }}/
run: make install

- name: Run tests
working-directory: ./model_servers/${{ matrix.image_name }}/
- name: Run non-gpu tests
working-directory: ./model_servers/${{ matrix.directory }}/
if: ${{ matrix.no_gpu }}
run: make test
env:
IMAGE_NAME: ${{ matrix.image_name }}

- name: Run cuda test
working-directory: ./model_servers/${{ matrix.directory }}/
if: ${{ matrix.cuda }}
run: make test-cuda
env:
IMAGE_NAME: ${{ matrix.image_name }}

- name: Login to Container Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: redhat-actions/podman-login@v1.7
Expand Down
Loading

0 comments on commit 3734eae

Please sign in to comment.