Skip to content

Commit

Permalink
Tests: Move tests running to self-hosted runners. (#161)
Browse files Browse the repository at this point in the history
* Move integration tests running to self-hosted runners.

* Move end-to-end tests running to self-hosted runners.

* Updated worklfow.

* HIL update.

* Fix.

* Update.

* Simple change.

* Final update.

* Add second option.

* Use testbed-list.
  • Loading branch information
kkeroo authored Jan 23, 2025
1 parent c188d97 commit cb780a7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 62 deletions.
41 changes: 10 additions & 31 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
required: true
default: 'oak4-pro'
depthai-version:
description: 'Version of depthai to install. Default: alpha6'
description: 'Version of depthai to install. Default: alpha11'
required: true
default: '3.0.0a11'
push:
Expand All @@ -29,36 +29,22 @@ on:

jobs:
HIL-test:
runs-on: ubuntu-latest
runs-on: ['self-hosted', 'testbed-runner']

strategy:
matrix:
python-version: [3.12]

steps:
- name: Setup WireGuard
- name: Update HIL
run: |
sudo apt install wireguard
echo "${{ secrets.WIREGUARD_PRIVATE_KEY }}" > privatekey
sudo ip link add dev wg0 type wireguard
sudo ip address add dev wg0 10.12.99.26 peer 10.12.99.1
sudo wg set wg0 listen-port 48123 private-key privatekey peer ${{ secrets.WIREGUARD_PUBLIC_KEY }} allowed-ips 10.12.99.1/32,10.12.99.26/32,10.12.0.0/16 endpoint "${{ secrets.WIREGUARD_PUBLIC_ENDPOINT }}"
sudo ip link set up dev wg0
sudo ip route add 10.12.0.0/16 dev wg0
cd /home/$USER/hil_framework
git pull
git submodule update --init --recursive
- name: Clone HIL Framework
run: |
git clone https://oauth2:${{secrets.GITLAB_TOKEN}}@gitlab.luxonis.com/luxonis/hil_lab/hil_framework.git --recursive
- name: Setup HIL Tools
run: |
cd hil_framework
sudo chmod +x ./setup/setup_hil_tools.sh
./setup/setup_hil_tools.sh -ga
- name: Add HIL Tools to Path
run: |
cd hil_framework
cd /home/$USER/hil_framework
echo "$(pwd)/lib_testbed/tools" >> $GITHUB_PATH
echo "PYTHONPATH="$PYTHONPATH:$(pwd)"" >> $GITHUB_ENV
echo "HIL_FRAMEWORK_PATH="$(pwd)"" >> $GITHUB_ENV
Expand All @@ -67,14 +53,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
CMD="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 --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"
else
CMD="hil --testbed oak4-pro --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'"
fi
eval $CMD
- name: Stop WireGuard
if: always()
run: |
sudo ip link set down dev wg0
sudo ip link delete dev wg0
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"
fi
41 changes: 10 additions & 31 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
required: true
default: 'oak4-s'
depthai-version:
description: 'Version of depthai to install. Default: alpha6'
description: 'Version of depthai to install. Default: alpha11'
required: true
default: '3.0.0a11'
pull_request:
Expand All @@ -29,36 +29,22 @@ on:

jobs:
Integration-test:
runs-on: ubuntu-latest
runs-on: ['self-hosted', 'testbed-runner']

strategy:
matrix:
python-version: [3.12]

steps:
- name: Setup WireGuard
- name: Update HIL
run: |
sudo apt install wireguard
echo "${{ secrets.WIREGUARD_PRIVATE_KEY }}" > privatekey
sudo ip link add dev wg0 type wireguard
sudo ip address add dev wg0 10.12.99.26 peer 10.12.99.1
sudo wg set wg0 listen-port 48123 private-key privatekey peer ${{ secrets.WIREGUARD_PUBLIC_KEY }} allowed-ips 10.12.99.1/32,10.12.99.26/32,10.12.0.0/16 endpoint "${{ secrets.WIREGUARD_PUBLIC_ENDPOINT }}"
sudo ip link set up dev wg0
sudo ip route add 10.12.0.0/16 dev wg0
- name: Clone HIL Framework
run: |
git clone https://oauth2:${{secrets.GITLAB_TOKEN}}@gitlab.luxonis.com/luxonis/hil_lab/hil_framework.git --recursive
- name: Setup HIL Tools
run: |
cd hil_framework
sudo chmod +x ./setup/setup_hil_tools.sh
./setup/setup_hil_tools.sh -ga
cd /home/$USER/hil_framework
git pull
git submodule update --init --recursive
- name: Add HIL Tools to Path
run: |
cd hil_framework
cd /home/$USER/hil_framework
echo "$(pwd)/lib_testbed/tools" >> $GITHUB_PATH
echo "PYTHONPATH="$PYTHONPATH:$(pwd)"" >> $GITHUB_ENV
echo "HIL_FRAMEWORK_PATH="$(pwd)"" >> $GITHUB_ENV
Expand All @@ -67,14 +53,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
CMD="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 --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
CMD="hil --testbed oak4-s --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
eval $CMD
- name: Stop WireGuard
if: always()
run: |
sudo ip link set down dev wg0
sudo ip link delete dev wg0
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

0 comments on commit cb780a7

Please sign in to comment.