Skip to content

Commit

Permalink
use environment variables for platform and dai version
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik737 committed Jan 9, 2025
1 parent 42a8232 commit 4dbe329
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ jobs:
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}-${{ matrix.platform }}"
hil --models $MODEL --reservation-name $RESERVATION_NAME --wait --sync-workspace --dockerfile ./test/Dockerfile --docker-build-args "--build-arg PYTHON_VERSION=${{ matrix.python-version }} --build-arg PLATFORM=${{ matrix.platform }} --build-arg DAI_VERSION=${{ github.event.inputs.depthai_version }}"
hil --models $MODEL --reservation-name $RESERVATION_NAME --wait --sync-workspace \
--dockerfile ./test/Dockerfile \
--docker-build-args "--build-arg PYTHON_VERSION=${{ matrix.python-version }}"
--docker-run-args "--env PLATFORM=${{ matrix.platform }} --env DAI_VERSION=${{ github.event.inputs.depthai_version }}"
22 changes: 13 additions & 9 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
ARG PYTHON_VERSION
ARG PLATFORM
ARG DAI_VERSION
FROM python:${PYTHON_VERSION}

RUN echo "Python version: ${PYTHON_VERSION}, PLATFORM: ${PLATFORM}, ${DAI_VERSION}"
ENV PLATFORM=""
ENV DAI_VERSION=""

# Install Virtual Display
RUN apt-get update && apt-get install -y \
Expand All @@ -14,9 +13,14 @@ RUN apt-get update && apt-get install -y \
ENV DISPLAY=:99

# Setup Test Command
RUN ls
RUN $CMD="python test/gen3_script_tester.py --environment-variables DEPTHAI_PLATFORM=${PLATFORM} --virtual-display --path ./neural-networks/advanced-examples/object-detection/mobile-object-localizer"
RUN if [ -n "$DAI_VERSION" ]; then CMD="$CMD --depthai-version $DAI_VERSION" fi
RUN CMD="$CMD'"

ENTRYPOINT ["/bin/sh", "-c", "eval $CMD"]
WORKDIR /tmp/depthai-experiments
ENTRYPOINT ["sh", "-c", "\
if [ -z \"$PLATFORM\" ]; then \
echo 'Error: PLATFORM environment variable is required' && \
exit 1; \
fi && \
python test/gen3_script_tester.py \
--environment-variables DEPTHAI_PLATFORM=${PLATFORM} \
--virtual-display \
--path ./neural-networks/advanced-examples/object-detection/mobile-object-localizer \
${DAI_VERSION:+--depthai-version ${DAI_VERSION}}"]

0 comments on commit 4dbe329

Please sign in to comment.