Add support for Replicate.ai models #299
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
name: "CI Model" | |
on: | |
push: | |
branches: [ master, model-api-v3 ] | |
paths: | |
- "model-inference/**" | |
- ".github/**" | |
pull_request: | |
branches: [ master ] | |
paths: | |
- "model-inference/**" | |
- ".github/**" | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
model_type: [ | |
"transformer", | |
"graph_transformer", | |
"sentence_transformer", | |
"onnx", | |
] | |
include: | |
- model_type: transformer | |
test_dir: transformer | |
test_setup: transformer | |
image_suffix: transformer | |
- model_type: graph_transformer | |
test_dir: transformer | |
test_setup: transformer | |
image_suffix: graph-transformer | |
- model_type: sentence_transformer | |
test_dir: sentence_transformer | |
test_setup: sentence_transformer | |
image_suffix: sentence-transformer | |
- model_type: onnx | |
test_dir: onnx | |
test_setup: onnx | |
image_suffix: onnx | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Delete huge unnecessary tools folder | |
run: rm -rf /opt/hostedtoolcache | |
- name: Prepare | |
id: transformer-prep | |
run: | | |
TAG=$(echo $GITHUB_SHA | head -c7) | |
echo $TAG | |
echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
IMAGE="ukpsquare/model-inference-${{ matrix.image_suffix }}" | |
echo $IMAGE | |
echo "image=${IMAGE}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
- name: Build test image | |
uses: docker/build-push-action@v3 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: ./model-inference | |
file: ./model-inference/Dockerfile | |
target: test | |
build-args: | | |
MODEL_TYPE=${{ matrix.model_type }} | |
TEST_DIR=${{ matrix.test_dir }} | |
TEST_SETUP=${{ matrix.test_setup }} | |
load: true | |
push: false | |
tags: ${{ steps.transformer-prep.outputs.image }}:ci-${{ steps.transformer-prep.outputs.tag }} | |
- name: Retrieve Test Reports | |
id: transformer-extract | |
uses: shrink/actions-docker-extract@v1 | |
with: | |
image: ${{ steps.transformer-prep.outputs.image }}:ci-${{ steps.transformer-prep.outputs.tag }} | |
path: /app/test-reports | |
- name: Upload Test Reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: model_api-test-reports | |
path: ${{ steps.transformer-extract.outputs.destination }}/test-reports | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
with: | |
report_paths: ${{ steps.transformer-extract.outputs.destination }}/test-reports/junit.xml | |
check_name: Transformers Test Report | |
fail_on_failure: true |