RepoReplicateReplicatepublished Apr 19, 2024seen 5d

replicate/build-cog

Open original ↗

Captured source

source ↗
published Apr 19, 2024seen 5dcaptured 8hhttp 200method plain

replicate/build-cog

Description: An experimental GitHub Actions workflow to build Cog from source

License: Apache-2.0

Stars: 0

Forks: 0

Open issues: 0

Created: 2024-04-19T17:10:47Z

Pushed: 2024-04-22T22:28:26Z

Default branch: main

Fork: no

Archived: no

README:

build-cog

This is a GitHub Action that builds Cog from source.

This is useful for testing unreleased versions of Cog, but you probably want [replicate/setup-cog](https://github.com/replicate/setup-cog) instead, which handles more setup like installing Docker buildx, installing NVIDIA's CUDA drivers, installing a release of Cog, logging in to Replicate, etc.

Usage

Add a step to your workflow that uses this action:

- name: Build Cog from source
uses: replicate/build-cog@v1
with:
commitish: "3cf1e44" # can be a SHA, branch name, or tag name

This will clone the Cog repository, checkout the specified commitish, compile the cog binary, and make it available in the PATH.

Now you can run the cog CLI in subsequent steps to cog run, cog build, cog push, etc.

Inputs

This following input can be specified using the with keyword:

commitish

In Git, a commitish is a reference that can be resolved to a commit, such as a commit hash, branch name, or tag name.

All of the following are examples of valid commitishs:

  • 3cf1e44: A commit hash prefix
  • 3cf1e448ca54088d797bc774ccc4b7a9f075aae0: A full commit hash
  • main: A branch name
  • v0.8.6: A tag name

This is optional. It defaults to main.

Example workflow

name: Push model to Replicate

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
docker-images: false

- name: Checkout my model code
uses: actions/checkout@v4

- name: Build cog binary from source
uses: replicate/build-cog@v1
with:
commitish: main

- name: Build the model
run: cog build

- name: Push to Replicate
run: cog push r8.im/my-username/my-model