Skip to content

xformers via push

xformers via push #15

name: xformers for NGC
run-name: xformers via ${{ github.event_name }}
on:
push:
branches:
- "main"
- "release"
paths:
- ".github/workflows/build-ngc-xformers.yaml"
- "docker/xformers/*"
- "docker-bake.xformers.hcl"
- "docker-bake.ngc.hcl"
- "!**.md"
workflow_dispatch:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
workflow_call:
inputs:
force-push:
description: "push to GHCR"
type: boolean
required: true
default: false
pull_request:
paths:
- ".github/workflows/build-ngc-xformers.yaml"
- "docker/xformers/*"
- "docker-bake.xformers.hcl"
- "docker-bake.ngc.hcl"
- "!**.md"
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-xformers
cancel-in-progress: true
env:
IMAGE_REGISTRY: ghcr.io
IMAGE_NAME: xformers
IMAGE_NAMESPACE: neggles/tensorpods
IMAGE_PLATFORMS: "linux/amd64"
# sorry pascal users but your cards are no good here
TORCH_CUDA_ARCH_LIST: "7.5;8.0;8.6;8.9;9.0"
# for ninja so the runner doesn't explode
MAX_JOBS: 1
jobs:
build:
name: NGC
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
fail-fast: false
max-parallel: 1
matrix:
include:
- target: "xformers"
ngc-ver: "23.08"
xformers-ver: "main"
- target: "xformers"
ngc-ver: "23.08"
xformers-ver: "v0.0.21"
- target: "xformers"
ngc-ver: "23.07"
xformers-ver: "v0.0.21"
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate docker tags
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
suffix=-ngc${{ matrix.ngc-ver }}
images: |
${{ env.IMAGE_REGISTRY }}/${{ github.repository }}/${{ matrix.target }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ matrix.xformers-ver }},enable={{is_default_branch}}
type=schedule,pattern={{date 'YYYYMMDD-hhmm' tz='UTC'}},enable={{is_default_branch}}
type=sha,format=short
type=ref,event=tag
type=ref,event=pr
labels: |
org.opencontainers.image.title=xformers-ngc
org.opencontainers.image.description=xformers wheel for NGC pytorch containers
org.opencontainers.image.vendor=neggles.dev
- name: Free disk space
id: free-disk-space
run: |
df -h .
sudo find "$AGENT_TOOLSDIRECTORY" -delete
sudo find /usr/share/dotnet -delete
sudo find /usr/local/lib/android -delete
df -h .
- name: Build & Push Image
id: build-push
uses: docker/bake-action@v3
env:
NGC_VERSION: ${{ matrix.ngc-ver }}
XFORMERS_REF: ${{ matrix.xformers-ver }}
with:
targets: ${{ matrix.target }}
files: |
./docker-bake.xformers.hcl
${{ steps.meta.outputs.bake-file }}
push: ${{ contains(fromJSON('["push", "schedule"]'), github.event_name) || inputs.force-push }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=min