Skip to content

Fix x-order bug (#2562) #7156

Fix x-order bug (#2562)

Fix x-order bug (#2562) #7156

Workflow file for this run

name: CI
on:
merge_group:
push:
branches: [main]
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
workflow_dispatch:
env:
HYPOTHESIS_PROFILE: ci
FORCE_COLOR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_NO_PYTHON_VERSION_WARNING: "1"
permissions: {}
jobs:
build-python:
name: Build & verify python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for setuptools_scm version determination
- uses: hynek/build-and-inspect-python-package@v2
id: baipp
outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
lint:
name: Lint
needs: build-python
runs-on: ubuntu-latest-8-cores
steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- name: Extract source distribution
run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/setup-python@v6
with:
python-version: 3.12
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
- name: Lint
run: make lint
test:
name: "Test Results"
needs:
- test-go
- test-python
- test-integration
runs-on: ubuntu-latest
steps:
- name: Check test status
run: echo "All tests passed successfully!"
test-go:
name: "Test Go"
needs: build-python
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources
platform: [ubuntu-latest, macos-latest]
new_docker_api_client: [true, false]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: make cog
- name: Test
run: make test-go
env:
COG_DOCKER_SDK_CLIENT: ${{ matrix.new_docker_api_client }}
test-python:
name: "Test Python ${{ matrix.python-version }} + Pydantic v${{ matrix.pydantic }}"
needs: build-python
runs-on: ubuntu-latest-8-cores
strategy:
fail-fast: false
matrix:
pydantic: ["1", "2"]
python-version: ${{ fromJson(needs.build-python.outputs.python-versions) }}
steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- name: Extract source distribution
run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: |
echo TOX_PYTHON=py$(echo "${{ matrix.python-version }}" | tr -d .) >>$GITHUB_ENV
uv pip install --system tox
- run: uv pip install --system tox-uv
- name: Remove src to ensure tests run against wheel
run: rm -rf python/cog
- name: Test
run: python -Im tox run --installpkg "$COG_WHEEL" -e ${{ env.TOX_PYTHON }}-pydantic${{ matrix.pydantic }}-tests
# TODO[md]: This is a gross hack, remove once this is sorted out: https://github.com/replicate/cog/pull/2353
# cannot run this on mac due to licensing issues: https://github.com/actions/virtual-environments/issues/2150
test-integration:
name: "Test integration"
needs: test-integration-matrix
runs-on: ubuntu-latest
steps:
- name: Check test status
run: echo "All tests passed successfully!"
# cannot run this on mac due to licensing issues: https://github.com/actions/virtual-environments/issues/2150
test-integration-matrix:
name: "Test integration Matrix"
needs: build-python
runs-on: ubuntu-latest-16-cores
strategy:
fail-fast: false
matrix:
new_docker_api_client: [true, false]
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: index.docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/setup-python@v6
with:
python-version: 3.12
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
- name: Test
run: make test-integration
env:
COG_DOCKER_SDK_CLIENT: ${{ matrix.new_docker_api_client }}
release:
name: "Release"
needs:
- test-go
- test-python
- test-integration
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for goreleaser version determination
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set COG_WHEEL
run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}