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 #216

add CI build matrix, refactoring, linting

add CI build matrix, refactoring, linting #216

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: |
echo "modified=$(
for model in $(ls -d *-*); do
git diff --quiet HEAD~1 -- $model || echo $model
done | 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 $BUILDX_ARGS
working-directory: ${{ matrix.model }}
env:
# can't load/test cross-CPU-platform, hence the mess below
BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }}
BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }}
TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }}