Build and Push to Replicate #10
Workflow file for this run
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 and Push to Replicate | |
on: | |
workflow_dispatch: | |
inputs: | |
git_branch: | |
description: 'Enter the git branch name to check out and push' | |
required: true | |
default: 'main' | |
# Ensure only one workflow instance runs at a time. For branches other than the | |
# default branch, cancel the pending jobs in the group. For the default branch, | |
# queue them up. This avoids cancelling jobs that are in the middle of deploying | |
# to production. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: pip install -r requirements-dev.txt | |
- name: Run pylint | |
run: | | |
pylint --recursive y tests/**/*.py | |
pylint --recursive y ./*.py | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: pip install -r requirements-dev.txt | |
- name: Run unit tests | |
run: pytest tests/unit | |
build-and-push: | |
name: Build and push | |
needs: [lint, unit-tests] | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-latest-16-cores | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.git_branch }} | |
- name: Setup Cog | |
uses: replicate/setup-cog@v2 | |
with: | |
token: ${{ secrets.REPLICATE_API_TOKEN }} | |
- name: Install Cog | |
run: | | |
COG_URL="https://github.com/replicate/cog/releases/download/v0.10.0-alpha20/cog_$(uname -s)_$(uname -m)" | |
sudo curl -o /usr/local/bin/cog -L "$COG_URL" | |
sudo chmod +x /usr/local/bin/cog | |
- name: Push to Replicate | |
env: | |
REPLICATE_API_TOKEN_ORG_REPLICATE_INTERNAL: ${{ secrets.REPLICATE_API_TOKEN_ORG_REPLICATE_INTERNAL }} | |
run: | | |
cog push r8.im/replicate/vllm | |
export REPLICATE_API_TOKEN=$REPLICATE_API_TOKEN_ORG_REPLICATE_INTERNAL | |
cog push r8.im/replicate-internal/vllm |