Skip to content

fix: torchvision circular dep #3422

fix: torchvision circular dep

fix: torchvision circular dep #3422

Workflow file for this run

name: CI
on:
pull_request_target:
paths-ignore:
- "**.md"
- ".github/workflows/*.yml"
- ".github/workflows/*.yaml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref }}
cancel-in-progress: true
jobs:
# see https://datachain.ai/blog/testing-external-contributions-using-github-actions-secrets
# the point of this is to forbid external contributors from running ci without explicit
# approval from the maintainers (via the environment external-contributors)
# this allows tests to be run with secrets on forks after the maintainers have approved the run
#
# note: you may think the "run ci with approval setting" in github is enough,
# but it doesn't work for pull_request_target
authorize:
environment: ${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external-contributors' || 'internal-contributors' }}
runs-on: ubuntu-latest
steps:
- run: true
build-and-test-extension:
needs: authorize
# services:
# ollama:
# image: ollama/ollama:latest
# ports:
# - 11434:11434
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: [16, 17]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
# in a pull_request_target event, the ref is the `main` branch not the PR branch
# so we need to tell checkout to use the head.ref instead.
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- uses: taiki-e/install-action@just
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Verify Docker installation
run: |
docker --version
docker info
- name: Build Docker image
run: just ext docker-build
env:
PG_MAJOR: ${{ matrix.postgres-version }}
- name: Run Docker container
run: just ext docker-run
- name: Build
run: docker exec pgai-ext just build
- name: Lint SQL and Python
run: docker exec pgai-ext just lint
- name: Check Python Formatting
run: docker exec pgai-ext just format
- name: Compare requirements file
run: docker exec pgai-ext just check-requirements
- name: Install extension
run: docker exec pgai-ext just install-all
- name: Run test server
run: docker exec -d
-e OPENAI_API_KEY
-e ANTHROPIC_API_KEY
-e COHERE_API_KEY
-e VOYAGE_API_KEY
pgai-ext just test-server
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
- name: Run tests
run: docker exec
-e OPENAI_API_KEY
-e ANTHROPIC_API_KEY
-e COHERE_API_KEY
-e VOYAGE_API_KEY
-e OLLAMA_HOST
pgai-ext just test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
OLLAMA_HOST: "0"
#OLLAMA_HOST: http://localhost:11434
- name: Stop and remove Docker container
run: |
just ext docker-stop
just ext docker-rm
build-and-test-pgai:
needs: authorize
services:
ollama:
image: ollama/ollama:latest
ports:
- 11434:11434
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# in a pull_request_target event, the ref is the `main` branch not the PR branch
# so we need to tell checkout to use the head.ref instead.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: taiki-e/install-action@just
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.10"
enable-cache: true
cache-dependency-glob: "./projects/pgai/uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "./projects/pgai/.python-version"
- name: CI pipeline. Install dependencies, run linters and formatters, execute tests and build the project",
run: just pgai ci
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
build-pgai-docker-image:
needs: authorize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# in a pull_request_target event, the ref is the `main` branch not the PR branch
# so we need to tell checkout to use the head.ref instead.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
uses: docker/build-push-action@v6
with:
context: "./projects/pgai"
push: false # we don't push the image, we just build it to validate it
platforms: linux/amd64,linux/arm64
build-and-test-pgai-db-module:
needs: authorize
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: [15, 16, 17]
fail-fast: false
steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- uses: actions/checkout@v4
with:
# in a pull_request_target event, the ref is the `main` branch not the PR branch
# so we need to tell checkout to use the head.ref instead.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: taiki-e/install-action@just
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.10"
enable-cache: true
cache-dependency-glob: "./projects/pgai/uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "./projects/pgai/.python-version"
- name: DB sub moduleCI pipeline. Install dependencies, run linters execute tests and build the project",
run: just pgai db ci
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PG_MAJOR: ${{ matrix.postgres-version }}
# This is a test to see if we can install the pgai package via pip
# It is used to check if the package is compatible with the python version
# and if the dependencies are correctly installed.
# NOTE: we are not using uv here because sometimes uv succeeds when pip fails
# and we want to fail if pip fails.
test-pgai-pip-install:
needs: authorize
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: true
steps:
- uses: actions/checkout@v4
with:
# in a pull_request_target event, the ref is the `main` branch not the PR branch
# so we need to tell checkout to use the head.ref instead.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Install via pip"
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -e .
working-directory: ./projects/pgai