Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

add CI build matrix, refactoring, linting #220

add CI build matrix, refactoring, linting

add CI build matrix, refactoring, linting #220

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: list
name: List modified models
run: |
git diff --stat HEAD~1
echo "modified=$(
for model in $(ls -d *-*); do
git diff --quiet HEAD~1 -- $model || echo $model
done | sort | jq -Rsc 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
outputs:
models: ${{ steps.list.outputs.modified }}
build-test-push:
needs: setup
runs-on: [self-hosted, gpu]
strategy:
fail-fast: false # TODO: remove
matrix:
model: ${{ fromJson(needs.setup.outputs.models) }}
env:
VERSION: '1.0.0'
DOCKER_BUILDKIT: 1
DOCKER_CLI_EXPERIMENTAL: enabled
COMPOSE_DOCKER_CLI_BUILD: 1
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }}
working-directory: ${{ matrix.model }}
env:
# can't load cross-CPU-platform
BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }}
# can't test cross-CPU-platform
TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }}
# avoid OoM errors (TODO: remove when using larger GPU)
TESTS_SKIP_GPU: ${{ contains(fromJSON('["a2t-whisper","cht-dolly-v2","cht-gorilla","cht-llama-v2","cht-mpt","cht-xgen","dfs-dalle","dfs-diffusers"]'), matrix.model) && '1' || '' }}
pass:
needs: build-test-push
runs-on: ubuntu-latest
steps:
- run: echo success