Skip to content

Commit

Permalink
Tests: Docker support. (#167)
Browse files Browse the repository at this point in the history
* Move integration tests to docker.

* Updated integration tests docker file.

* Fix the dai version passing argument.

* Added E2E tests in docker.

* Fix model names in integration tests.
  • Loading branch information
kkeroo authored Jan 30, 2025
1 parent 36b31d3 commit 6cce15b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 17 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
description: 'Branch to run the tests on. Default: main'
required: true
default: 'main'
testbed:
description: 'Testbed to run the tests on. Available: oak4-pro, oak4-s'
required: true
default: 'oak4-pro'
depthai-version:
description: 'Version of depthai to install. Default: alpha11'
required: true
Expand Down Expand Up @@ -53,7 +49,7 @@ jobs:
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
hil --testbed ${{ github.event.inputs.testbed }} --wait --reservation-name $RESERVATION_NAME --commands "cd /home/hil/depthai-nodes" "git checkout main" "git pull" "git checkout ${{ github.event.inputs.branch }}" "git pull" "source venv/bin/activate" "pip install --extra-index-url ${{secrets.LUXONIS_EXTRA_INDEX_URL}} depthai==${{ github.event.inputs.depthai-version }}" "cd tests/end_to_end" "source <(python setup_camera_ips.py)" "export HUBAI_TEAM_SLUG=${{ secrets.HUBAI_TEAM_SLUG }}" "export HUBAI_API_KEY=${{ secrets.HUBAI_API_KEY }}" "python main.py ${{ github.event.inputs.additional-parameter }}" "deactivate"
hil --capabilities "depthai-core-hil" --wait --reservation-name $RESERVATION_NAME --before-docker-pull "echo ${{secrets.GHCR_PAT}} | docker login ghcr.io -u ${{secrets.GHCR_USER}} --password-stdin" --docker-image ghcr.io/luxonis/depthai-nodes-testing --docker-run-args "--env LUXONIS_EXTRA_INDEX_URL=${{secrets.LUXONIS_EXTRA_INDEX_URL}} --env DEPTHAI_VERSION=${{ github.event.inputs.depthai-version }} --env HUBAI_TEAM_SLUG=${{ secrets.HUBAI_TEAM_SLUG }} --env HUBAI_API_KEY=${{ secrets.HUBAI_API_KEY }} --env BRANCH=${{ github.event.inputs.branch }} --env FLAGS=\"${{ github.event.inputs.additional-parameter }}\""
else
hil --testbed-list oak4-pro oak4-s --wait --reservation-name $RESERVATION_NAME --commands "cd /home/hil/depthai-nodes" "git checkout main" "git pull" "source venv/bin/activate" "pip install --extra-index-url ${{secrets.LUXONIS_EXTRA_INDEX_URL}} depthai==3.0.0a11" "cd tests/end_to_end" "source <(python setup_camera_ips.py)" "export HUBAI_TEAM_SLUG=${{ secrets.HUBAI_TEAM_SLUG }}" "export HUBAI_API_KEY=${{ secrets.HUBAI_API_KEY }}" "python main.py -all" "deactivate"
hil --capabilities "depthai-core-hil" --wait --reservation-name $RESERVATION_NAME --before-docker-pull "echo ${{secrets.GHCR_PAT}} | docker login ghcr.io -u ${{secrets.GHCR_USER}} --password-stdin" --docker-image ghcr.io/luxonis/depthai-nodes-testing --docker-run-args "--env LUXONIS_EXTRA_INDEX_URL=${{secrets.LUXONIS_EXTRA_INDEX_URL}} --env DEPTHAI_VERSION=\"3.0.0a11\" --env HUBAI_TEAM_SLUG=${{ secrets.HUBAI_TEAM_SLUG }} --env HUBAI_API_KEY=${{ secrets.HUBAI_API_KEY }} --env BRANCH=\"main\" --env FLAGS=\"-all\""
fi
8 changes: 2 additions & 6 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
description: 'Branch to run the tests on. Default: main'
required: true
default: 'main'
testbed:
description: 'Testbed to run the tests on. Available: oak4-pro, oak4-s'
required: true
default: 'oak4-s'
depthai-version:
description: 'Version of depthai to install. Default: alpha11'
required: true
Expand Down Expand Up @@ -53,7 +49,7 @@ jobs:
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
hil --testbed ${{ github.event.inputs.testbed }} --wait --reservation-name $RESERVATION_NAME --commands "cd /home/hil/depthai-nodes" "git checkout main" "git pull" "git checkout ${{ github.event.inputs.branch }}" "git pull" "source venv/bin/activate" "pip install --extra-index-url ${{secrets.LUXONIS_EXTRA_INDEX_URL}} depthai==${{ github.event.inputs.depthai-version }}" "cd tests/integration_tests" "export B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }}" "export B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }}" "python main.py ${{ github.event.inputs.additional-parameter }}" "deactivate"
hil --capabilities "depthai-core-hil" --wait --reservation-name $RESERVATION_NAME --before-docker-pull "echo ${{secrets.GHCR_PAT}} | docker login ghcr.io -u ${{secrets.GHCR_USER}} --password-stdin" --docker-image ghcr.io/luxonis/depthai-nodes-integration-testing --docker-run-args "--env LUXONIS_EXTRA_INDEX_URL=${{secrets.LUXONIS_EXTRA_INDEX_URL}} --env DEPTHAI_VERSION=${{ github.event.inputs.depthai-version }} --env B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }} --env B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }} --env BRANCH=${{ github.event.inputs.branch }} --env FLAGS=\"${{ github.event.inputs.additional-parameter }}\""
else
hil --testbed-list oak4-s oak4-pro --wait --reservation-name $RESERVATION_NAME --commands "cd /home/hil/depthai-nodes" "git checkout main" "git pull" "git checkout ${{ github.head_ref }}" "git pull" "source venv/bin/activate" "pip install --extra-index-url ${{secrets.LUXONIS_EXTRA_INDEX_URL}} depthai==3.0.0a11" "cd tests/integration_tests" "export B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }}" "export B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }}" "python main.py -all --download" "deactivate"
hil --capabilities "depthai-core-hil" --wait --reservation-name $RESERVATION_NAME --before-docker-pull "echo ${{secrets.GHCR_PAT}} | docker login ghcr.io -u ${{secrets.GHCR_USER}} --password-stdin" --docker-image ghcr.io/luxonis/depthai-nodes-integration-testing --docker-run-args "--env LUXONIS_EXTRA_INDEX_URL=${{secrets.LUXONIS_EXTRA_INDEX_URL}} --env DEPTHAI_VERSION=\"3.0.0a11\" --env B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }} --env B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }} --env BRANCH=${{ github.head_ref }} --env FLAGS=\"-all --download\""
fi
29 changes: 29 additions & 0 deletions tests/end_to_end/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use the official Python 3.8 image from the Docker Hub
FROM python:3.8-slim

# Set the working directory
WORKDIR /app

# Install git
RUN apt-get update && apt-get install -y git

RUN apt install libgl1-mesa-glx -y
RUN apt-get install ffmpeg libsm6 libxext6 -y

# Clone the depthai-nodes repository
RUN git clone https://github.com/luxonis/depthai-nodes.git

# Set the working directory to the cloned repository
WORKDIR /app/depthai-nodes

# Install the depthai-nodes package
RUN pip install -e .

# Install the development requirements
RUN pip install -r requirements-dev.txt

# Set the working directory to the tests directory
WORKDIR /app/depthai-nodes/tests/end_to_end

# Run the setup script and the tests
ENTRYPOINT ["bash", "-c", "git checkout main && git pull && git checkout $BRANCH && git pull && pip install --extra-index-url $LUXONIS_EXTRA_INDEX_URL depthai==$DEPTHAI_VERSION && source <(python setup_camera_ips.py) && python main.py $FLAGS"]
29 changes: 29 additions & 0 deletions tests/integration_tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use the official Python 3.8 image from the Docker Hub
FROM python:3.8-slim

# Set the working directory
WORKDIR /app

# Install git
RUN apt-get update && apt-get install -y git

RUN apt install libgl1-mesa-glx -y
RUN apt-get install ffmpeg libsm6 libxext6 -y

# Clone the depthai-nodes repository
RUN git clone https://github.com/luxonis/depthai-nodes.git

# Set the working directory to the cloned repository
WORKDIR /app/depthai-nodes

# Install the depthai-nodes package
RUN pip install -e .

# Install the development requirements
RUN pip install -r requirements-dev.txt

# Set the working directory to the tests directory
WORKDIR /app/depthai-nodes/tests/integration_tests

# Run the setup script and the tests
ENTRYPOINT ["bash", "-c", "git checkout main && git pull && git checkout $BRANCH && git pull && pip install --extra-index-url $LUXONIS_EXTRA_INDEX_URL depthai==$DEPTHAI_VERSION && python -u main.py $FLAGS"]
10 changes: 5 additions & 5 deletions tests/integration_tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
"ClassificationSequenceParser": ["luxonis/paddle-text-recognition:320x48"],
"EmbeddingsParser": ["luxonis/arcface:lfw-112x112"],
"FastSAMParser": ["luxonis/fastsam-s:512x288"],
"HRNetParser": ["luxonis/lite-hrnet:18-coco-256x192"],
"ImageOutputParser": ["luxonis/dncnn3:240x320"],
"HRNetParser": ["luxonis/lite-hrnet:18-coco-192x256"],
"ImageOutputParser": ["luxonis/dncnn3:320x240"],
"KeypointParser": ["luxonis/mediapipe-face-landmarker:192x192"],
"LaneDetectionParser": ["luxonis/ultra-fast-lane-detection:culane-800x288"],
"MapOutputParser": ["luxonis/dm-count:sha-144x256"],
"MapOutputParser": ["luxonis/dm-count:sha-426x240"],
"MPPalmDetectionParser": ["luxonis/mediapipe-palm-detection:192x192"],
"MLSDParser": ["luxonis/m-lsd-tiny:512x512"],
"PPTextDetectionParser": ["luxonis/paddle-text-detection:256x256"],
"SCRFDParser": ["luxonis/scrfd-face-detection:10g-640x640"],
"SegmentationParser": [
"luxonis/mediapipe-selfie-segmentation:144x256",
"luxonis/mediapipe-selfie-segmentation:256x144",
"luxonis/deeplab-v3-plus:256x256",
],
"SuperAnimalParser": ["luxonis/superanimal-landmarker:256x256"],
"YOLOExtendedParser": [
"luxonis/yolov8-instance-segmentation-nano:coco-512x288",
"luxonis/yolov8-nano-pose-estimation:coco-512x288",
],
"YuNetParser": ["luxonis/yunet:new-240x320"],
"YuNetParser": ["luxonis/yunet:320x240"],
"RegressionParser": ["luxonis/gaze-estimation-adas:60x60"],
}

0 comments on commit 6cce15b

Please sign in to comment.