Skip to content

first stab standalone tests #272

first stab standalone tests

first stab standalone tests #272

Workflow file for this run

name: Gen3 Experiments Runnability Test

Check failure on line 1 in .github/workflows/run_test.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run_test.yml

Invalid workflow file

you may only define up to 10 `inputs` for a `workflow_dispatch` event
on:
workflow_dispatch:
inputs:
distinct_id:
description: 'run identifier'
required: false
depthai_version:
description: 'Version of DepthAI to install for the test run. If specified the version will override version specified in requirements.txt'
required: false
depthai_nodes_version:
description: 'Version of depthai-nodes to install for the test run. If specified the version will override version specified in requirements.txt'
required: false
python_version:
description: 'Python version to use. By default 3.8, 3.10 and 3.12 are used but you can use only one by passing only `3.8`, `3.10` or `3.12`.'
default: "all"
required: false
hold_reservation:
description: 'If this is set to true testbed will stay reserved after process is done - reccomended for CI use'
required: false
type: boolean
reservation_name:
description: 'Reservation name - usually usually unique identifier of root CI run'
required: false
type: string
platform:
description: 'Platform to use for testing. By default both RVC2 and RVC4 are used but you can use only one by passing only `rvc2` or `rvc4`(use lowercase).'
default: "all"
required: false
log_level:
description: 'Log level to use for pytest.'
type: choice
options:
- ERROR
- INFO
- DEBUG
default: INFO
required: false
root_dir:
decription: 'Root directory of the experiments you want to test. Defaults to all experiments.'
default: "."
required: false
strict_mode:
description: "If set to 'yes', tests will fail on DepthAI warnings."
type: choice
options:
- "yes"
- "no"
default: "no"
required: false
subtests:
description: "Specify if should run only peripheral, only standalone or both"
type: choice
options:
- "all"
- "peripheral"
- "standalone"
default: "all"
required: false
jobs:
id:
name: Workflow ID Provider
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
setup:
runs-on: ubuntu-latest
outputs:
matrix_platform: ${{ steps.set-matrix.outputs.platform }}
matrix_python: ${{ steps.set-matrix.outputs.python }}
steps:
- id: set-matrix
env:
INPUT_PLATFORM: ${{ github.event.inputs.platform }}
INPUT_PYTHON: ${{ github.event.inputs.python_version }}
run: |
if [ "$INPUT_PLATFORM" = "all" ]; then
echo 'platform=["rvc2","rvc4"]' >> $GITHUB_OUTPUT
else
echo "platform=[\"$INPUT_PLATFORM\"]" >> $GITHUB_OUTPUT
fi
if [ "$INPUT_PYTHON" = "all" ]; then
echo 'python=["3.8", "3.10", "3.12"]' >> $GITHUB_OUTPUT
else
echo "python=[\"$INPUT_PYTHON\"]" >> $GITHUB_OUTPUT
fi
update-hil:
runs-on: ["self-hosted", "testbed-runner"]
needs: setup
steps:
- name: Update HIL
run: |
cd /home/$USER/hil_framework
git pull https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.luxonis.com/luxonis/hil_lab/hil_framework.git
git fetch
git checkout main
test_peripheral:
needs: [setup, update-hil]
runs-on: ["self-hosted", "testbed-runner"]
strategy:
matrix:
python-version: ${{ fromJSON(needs.setup.outputs.matrix_python) }}
platform: ${{ fromJSON(needs.setup.outputs.matrix_platform) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add HIL Tools to Path
run: |
echo "/home/$USER/hil_framework/lib_testbed/tools" >> $GITHUB_PATH
echo "PYTHONPATH="$PYTHONPATH:/home/$USER/hil_framework"" >> $GITHUB_ENV
echo "HIL_FRAMEWORK_PATH="/home/$USER/hil_framework"" >> $GITHUB_ENV
- name: Set model variable
run: |
if [ "${{ matrix.platform }}" = "rvc2" ]; then
echo "MODEL=oak_d_s2" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "rvc4" ]; then
echo "MODEL=oak4_pro or oak4_d" >> $GITHUB_ENV
fi
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#${{ matrix.python-version}}-${{ matrix.platform }}"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
ENV_VARS="\
--env PLATFORM=${{ matrix.platform }} \
--env DAI_VERSION=${{ github.event.inputs.depthai_version }} \
--env DAI_NODES_VERSION=${{ github.event.inputs.depthai_nodes_version }} \
--env PYTHON_VERSION_ENV=${{ matrix.python-version }} \
--env LOG_LEVEL=${{ github.event.inputs.log_level }} \
--env ROOT_DIR=${{ github.event.inputs.root_dir }} \
--env STRICT_MODE=${{ github.event.inputs.strict_mode }} "
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ "${{ github.event.inputs.hold_reservation }}" == 'true' ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
exec hil --models "$MODEL" $RESERVATION_OPTION $HOLD_RESERVATION --wait --sync-workspace \
--dockerfile ./tests/Dockerfile_peripheral \
--docker-build-args "--build-arg PYTHON_VERSION=${{ matrix.python-version }}" \
--docker-run-args "$ENV_VARS"
test_standalone:
needs: [setup, update-hil]
runs-on: ["self-hosted", "testbed-runner"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add HIL Tools to Path
run: |
echo "/home/$USER/hil_framework/lib_testbed/tools" >> $GITHUB_PATH
echo "PYTHONPATH="$PYTHONPATH:/home/$USER/hil_framework"" >> $GITHUB_ENV
echo "HIL_FRAMEWORK_PATH="/home/$USER/hil_framework"" >> $GITHUB_ENV
- name: Run Test
run: |
export RESERVATION_NAME="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#standalone"
export INFLUXDB_TOKEN=${{ secrets.INFLUXDB_TOKEN }}
ENV_VARS="\
--env PLATFORM="rvc4" \
--env DAI_VERSION=${{ github.event.inputs.depthai_version }} \
--env DAI_NODES_VERSION=${{ github.event.inputs.depthai_nodes_version }} \
--env PYTHON_VERSION_ENV="3.12" \
--env LOG_LEVEL=${{ github.event.inputs.log_level }} \
--env ROOT_DIR=${{ github.event.inputs.root_dir }} \
--env STRICT_MODE=${{ github.event.inputs.strict_mode }} "
if [[ -n "${{ github.event.inputs.reservation_name }}" ]]; then
RESERVATION_OPTION="--reservation-name ${{ github.event.inputs.reservation_name }}"
else
RESERVATION_OPTION="--reservation-name $RESERVATION_NAME"
fi
if [[ "${{ github.event.inputs.hold_reservation }}" == 'true' ]]; then
HOLD_RESERVATION="--hold-reservation"
fi
exec hil --models "oak4_pro or oak4_d" $RESERVATION_OPTION $HOLD_RESERVATION --wait --sync-workspace \
--dockerfile ./tests/Dockerfile_standalone \
--docker-build-args "--build-arg PYTHON_VERSION=${{ matrix.python-version }}" \
--docker-run-args "$ENV_VARS"