-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e26727a
commit f669696
Showing
7 changed files
with
610 additions
and
12 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.github/workflows/integration_tests_inference_cli_depending_on_inference_x86.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: INTEGRATION TESTS - inference CLI + inference CORE | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call_is_mergeable: | ||
uses: ./.github/workflows/is_mergeable.yml | ||
secrets: inherit | ||
build-dev-test: | ||
needs: call_is_mergeable | ||
if: ${{ github.event_name != 'pull_request' || needs.call_is_mergeable.outputs.mergeable_state != 'not_clean' }} | ||
runs-on: | ||
labels: depot-ubuntu-22.04-small | ||
group: public-depot | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
check-latest: true | ||
- name: 📦 Cache Python packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/**') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip-${{ matrix.python-version }}- | ||
- name: 📦 Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade setuptools | ||
pip install --extra-index-url https://download.pytorch.org/whl/cpu -r requirements/_requirements.txt -r requirements/requirements.cpu.txt -r requirements/requirements.sdk.http.txt -r requirements/requirements.test.unit.txt -r requirements/requirements.http.txt -r requirements/requirements.yolo_world.txt -r requirements/requirements.doctr.txt -r requirements/requirements.sam.txt -r requirements/requirements.transformers.txt -r requirements/requirements.cli.txt -r requirements/requirements.sdk.http.txt | ||
- name: 🧪 Integration Tests of Inference CLI | ||
run: RUN_TESTS_WITH_INFERENCE_PACKAGE=True INFERENCE_CLI_TESTS_API_KEY=${{ secrets.LOAD_TEST_PRODUCTION_API_KEY }} python -m pytest tests/inference_cli/integration_tests/test_workflows.py |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,76 @@ | ||
import os.path | ||
import tempfile | ||
from typing import Generator | ||
|
||
import pytest | ||
import requests | ||
|
||
ASSETS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "assets")) | ||
IMAGES_URLS = [ | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/aFq7tthQAK6d4pvtupX7/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/KmFskd2RQMfcnDNjzeeA/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/3FBCYL5SX7VPrg0OVkdN/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/K2KrTzjxYu0kJCScGcoH/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/XzDB9zVrIxJm17iVKleP/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/0fsReHjmHk3hBadXdNk4/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/t23lZ0inksJwRRLd3J1b/original.jpg", | ||
"https://source.roboflow.com/BTRTpB7nxxjUchrOQ9vT/3iCH40NuJxcf8l2tXgQn/original.jpg", | ||
] | ||
VIDEO_URL = "https://media.roboflow.com/inference/people-walking.mp4" | ||
|
||
INFERENCE_CLI_TESTS_API_KEY = os.getenv("INFERENCE_CLI_TESTS_API_KEY") | ||
RUN_TESTS_WITH_INFERENCE_PACKAGE = ( | ||
os.getenv("RUN_TESTS_WITH_INFERENCE_PACKAGE", "False").lower() == "true" | ||
) | ||
RUN_TESTS_EXPECTING_ERROR_WHEN_INFERENCE_NOT_INSTALLED = ( | ||
os.getenv("RUN_TESTS_EXPECTING_ERROR_WHEN_INFERENCE_NOT_INSTALLED", "False").lower() | ||
== "true" | ||
) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def empty_directory() -> Generator[str, None, None]: | ||
with tempfile.TemporaryDirectory() as tmp_dir: | ||
yield tmp_dir | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def example_env_file_path() -> str: | ||
return os.path.abspath( | ||
os.path.join(os.path.dirname(__file__), "assets", "example.env") | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def dataset_directory() -> str: | ||
dataset_directory = os.path.join(ASSETS_DIR, "test_images") | ||
os.makedirs(dataset_directory, exist_ok=True) | ||
expected_video_name = "video.mp4" | ||
current_content = set(os.listdir(dataset_directory)) | ||
all_images_present = all( | ||
f"{i}.jpg" in current_content for i in range(len(IMAGES_URLS)) | ||
) | ||
if all_images_present and expected_video_name in current_content: | ||
return dataset_directory | ||
for i, image_url in enumerate(IMAGES_URLS): | ||
response = requests.get(image_url) | ||
response.raise_for_status() | ||
image_bytes = response.content | ||
with open(os.path.join(dataset_directory, f"{i}.jpg"), "wb") as f: | ||
f.write(image_bytes) | ||
response = requests.get(VIDEO_URL) | ||
response.raise_for_status() | ||
video_bytes = response.content | ||
with open(os.path.join(dataset_directory, "video.mp4"), "wb") as f: | ||
f.write(video_bytes) | ||
return dataset_directory | ||
|
||
|
||
@pytest.fixture | ||
def video_to_be_processed(dataset_directory: str) -> str: | ||
return os.path.join(dataset_directory, "video.mp4") | ||
|
||
|
||
@pytest.fixture | ||
def image_to_be_processed(dataset_directory: str) -> str: | ||
return os.path.join(dataset_directory, "0.jpg") |
Oops, something went wrong.