Infernet Services Tests #49
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
# pre-commit workflow | |
# | |
# Ensures the codebase passes the pre-commit stack. | |
name: Infernet Services Tests | |
on: | |
schedule: | |
- cron: '0 0 * * 2-6' # every day at midnight, Tue-Sat | |
pull_request: | |
paths: | |
- 'infernet_services/**' | |
- '.github/workflows/infernet_services_tests.yaml' | |
workflow_dispatch: | |
inputs: | |
docker-tag: | |
description: 'Infernet Node Docker tag' | |
required: true | |
type: string | |
default: 'latest' | |
jobs: | |
build-docker-and-run-e2e-tests: | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
service: [ | |
"hf_inference_client_service", | |
"tgi_client_inference_service", | |
"css_inference_service", | |
"onnx_inference_service", | |
"torch_inference_service", | |
"ezkl_proof_service" | |
] | |
fail-fast: false | |
steps: | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_GH_ACTIONS }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# pull submodules manually since some are private | |
- run: | | |
git submodule sync --recursive | |
git -c protocol.version=2 submodule update --init --force --recursive | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: init repo | |
run: | | |
echo '${{ secrets.SECRETS_SA }}' > secrets-sa-key.json | |
gcloud auth activate-service-account --key-file=secrets-sa-key.json | |
make init-repo | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Print Docker Tag | |
run: | | |
echo "Docker tag: ${{ github.event.inputs.docker-tag }}" | |
- name: Pull service images | |
env: | |
# use default Docker tag if it's not specified | |
INFERNET_NODE_TAG: ${{ github.event.inputs.docker-tag || '1.3.0' }} | |
run: | | |
docker compose -f infernet_services/deploy/docker-compose.yaml pull | |
docker pull "ritualnetwork/infernet-anvil:0.0.0" | |
- name: Build the container | |
env: | |
service: ${{ matrix.service }} | |
CI: true | |
run: | | |
make build-service | |
# useful for faster iteration time when debugging | |
# docker pull ritualnetwork/${{ matrix.service }}_internal:1.0.0 | |
- name: Install UV | |
run: python -m pip install uv | |
# Can't install from uv with the --system flag much like what we do in our | |
# dockerfiles, because we'd have to run it as root. | |
- name: Create virtual environment | |
run: uv venv -p 3.11 | |
- name: Activate virtual environment | |
run: | | |
. .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
- name: Get UV env file | |
run: make generate-uv-env-file export_prefix="" && cat uv.env >> $GITHUB_ENV | |
- name: Install dependencies | |
run: uv pip install --extra-index-url `make get-index-url` -r infernet_services/requirements-e2e-tests.lock | |
- name: Run tests | |
env: | |
# We need to list the env vars here again for them to get filtered out in logs | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
MODEL_OWNER: ${{ secrets.MODEL_OWNER }} | |
GOOSEAI_API_KEY: ${{ secrets.GOOSEAI_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
PERPLEXITYAI_API_KEY: ${{ secrets.PERPLEXITYAI_API_KEY }} | |
service: ${{ matrix.service }} | |
INFERNET_NODE_TAG: ${{ github.event.inputs.docker-tag || '1.3.0' }} | |
run: make test-service | |
- name: Cleanup Secrets | |
run: rm secrets-sa-key.json | |
if: always() |