Skip to content

Commit

Permalink
Added E2E tests in docker.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkeroo committed Jan 30, 2025
1 parent eb2d58c commit 1662ab1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 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
12 changes: 0 additions & 12 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 @@ -49,14 +45,6 @@ jobs:
echo "PYTHONPATH="$PYTHONPATH:$(pwd)"" >> $GITHUB_ENV
echo "HIL_FRAMEWORK_PATH="$(pwd)"" >> $GITHUB_ENV
# - name: Run Test
# 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"
# 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"
# fi
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}"
Expand Down
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"]
6 changes: 1 addition & 5 deletions tests/integration_tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Use the official Python 3.8 image from the Docker Hub
ARG PYTHON_VERSION
FROM python:3.8-slim

# Set the working directory
Expand Down Expand Up @@ -27,7 +26,4 @@ RUN pip install -r requirements-dev.txt
WORKDIR /app/depthai-nodes/tests/integration_tests

# Run the setup script and the tests

# CMD ["bash"]
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"]
# 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 -all"]
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"]

0 comments on commit 1662ab1

Please sign in to comment.