feat(runner): add transformers pipeline logic #726
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: Build ai-runner pipeline Docker images | |
on: | |
pull_request: | |
paths: | |
- "runner/**" | |
- "!runner/.devcontainer/**" | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
paths: | |
- "runner/**" | |
- "!runner/.devcontainer/**" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: ${{ !((github.ref_type == 'branch' && github.ref_name == 'main') || github.ref_type == 'tag') }} | |
jobs: | |
build-and-push-docker-images: | |
name: Build and push pipeline Docker images | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch' | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
dockerfile: | |
- docker/Dockerfile.segment_anything_2 | |
- docker/Dockerfile.text_to_speech | |
- docker/Dockerfile.audio_to_text | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
# Check https://github.com/livepeer/go-livepeer/pull/1891 | |
# for ref value discussion | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cleanup hosted runner | |
uses: ./.github/actions/cleanup-runner | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.CI_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CI_DOCKERHUB_TOKEN }} | |
- name: Extract Pipeline tag from Dockerfile suffix | |
id: docker-tag | |
run: | | |
suffix=$(basename "${{ matrix.dockerfile }}" | sed 's/Dockerfile.//;s/_/-/g') | |
echo "suffix=$suffix" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
livepeer/ai-runner | |
tags: | | |
type=raw,value=${{ steps.docker-tag.outputs.suffix }} | |
type=sha,prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=ref,event=pr,prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=ref,event=tag,prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=sha,format=long,prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=ref,event=branch,prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=semver,pattern={{version}},prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=semver,pattern={{major}}.{{minor}},prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=semver,pattern={{version}},prefix=${{ steps.docker-tag.outputs.suffix }}-v | |
type=semver,pattern={{major}}.{{minor}},prefix=${{ steps.docker-tag.outputs.suffix }}-v | |
type=raw,value=latest,enable={{is_default_branch}},prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=raw,value=${{ github.event.pull_request.head.ref }},enable=${{ github.event_name == 'pull_request' }},prefix=${{ steps.docker-tag.outputs.suffix }}- | |
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }},prefix=${{ steps.docker-tag.outputs.suffix }}- | |
- name: Build and push runner docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:runner" | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
file: ${{ matrix.dockerfile }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=livepeerci/build:cache | |
cache-to: type=registry,ref=livepeerci/build:cache,mode=max |