|
| 1 | +name: Run hil tests for windows |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + luxonis_os_versions_to_test: |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + secrets: |
| 9 | + CONTAINER_REGISTRY: |
| 10 | + required: true |
| 11 | + HIL_PAT_TOKEN: |
| 12 | + required: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + build_windows_tests: |
| 16 | + runs-on: windows-latest |
| 17 | + outputs: |
| 18 | + artifact_id: ${{ steps.reuse.outputs.artifact_id || steps.artifact-upload-step.outputs.artifact-id }} |
| 19 | + env: |
| 20 | + BUILD_TYPE: Release |
| 21 | + VCPKG_ROOT: C:\vcpkg |
| 22 | + VCPKG_FEATURE_FLAGS: manifests,registries,binarycaching |
| 23 | + VCPKG_DEFAULT_TRIPLET: x64-windows |
| 24 | + VCPKG_DOWNLOADS: C:\vcpkg_downloads |
| 25 | + VCPKG_DEFAULT_BINARY_CACHE: C:\vcpkg_binaries |
| 26 | + steps: |
| 27 | + |
| 28 | + - name: Try reusing existing artifact for this commit |
| 29 | + id: reuse |
| 30 | + shell: pwsh |
| 31 | + env: |
| 32 | + GH_TOKEN: ${{ github.token }} |
| 33 | + REPO: ${{ github.repository }} |
| 34 | + RUN_ID: ${{ github.run_id }} |
| 35 | + ARTIFACT_NAME: depthai-core-win-${{ github.sha }} |
| 36 | + run: | |
| 37 | + Write-Host "REPO=$env:REPO RUN_ID=$env:RUN_ID NAME=$env:ARTIFACT_NAME" |
| 38 | + $id = gh api "repos/$env:REPO/actions/runs/$env:RUN_ID/artifacts" ` |
| 39 | + --jq ".artifacts[] | select(.name==""$env:ARTIFACT_NAME"" and .expired==false) | .id" |
| 40 | + if ($id) { |
| 41 | + "skip_build=true" >> $env:GITHUB_OUTPUT |
| 42 | + "artifact_id=$id" >> $env:GITHUB_OUTPUT |
| 43 | + Write-Host "Found artifact id=$id on this run; skipping build." |
| 44 | + } else { |
| 45 | + "skip_build=false" >> $env:GITHUB_OUTPUT |
| 46 | + Write-Host "No artifact named $env:ARTIFACT_NAME on this run." |
| 47 | + } |
| 48 | +
|
| 49 | +
|
| 50 | + - name: Checkout depthai |
| 51 | + uses: actions/checkout@v4 |
| 52 | + if: steps.reuse.outputs.skip_build != 'true' |
| 53 | + with: |
| 54 | + submodules: recursive |
| 55 | + |
| 56 | + - name: Ensure cache dirs and build dir |
| 57 | + shell: powershell |
| 58 | + if: steps.reuse.outputs.skip_build != 'true' |
| 59 | + run: | |
| 60 | + New-Item -ItemType Directory -Force -Path "C:\vcpkg_binaries" | Out-Null |
| 61 | + New-Item -ItemType Directory -Force -Path "C:\depthai-core" | Out-Null |
| 62 | + Write-Host "Copying source from $env:GITHUB_WORKSPACE to C:\depthai-core ..." |
| 63 | + Copy-Item -Path "$env:GITHUB_WORKSPACE\*" -Destination "C:\depthai-core" -Recurse -Force |
| 64 | +
|
| 65 | + - name: Cache vcpkg binary cache |
| 66 | + uses: actions/cache@v4 |
| 67 | + if: steps.reuse.outputs.skip_build != 'true' |
| 68 | + with: |
| 69 | + path: C:\vcpkg_binaries |
| 70 | + key: vcpkg-archives-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.VCPKG_DEFAULT_TRIPLET }} |
| 71 | + restore-keys: | |
| 72 | + vcpkg-archives-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}-${{ env.VCPKG_DEFAULT_TRIPLET }} |
| 73 | +
|
| 74 | + - name: Configure and Build |
| 75 | + if: steps.reuse.outputs.skip_build != 'true' |
| 76 | + run: | |
| 77 | + cd C:\depthai-core |
| 78 | + Invoke-WebRequest ` |
| 79 | + -Uri "https://github.com/winpython/winpython/releases/download/17.2.20250920/WinPython64-3.13.7.0dotrc.zip" ` |
| 80 | + -OutFile "winpython.zip" |
| 81 | + New-Item -ItemType Directory -Force -Path "C:\depthai-core\winpython" | Out-Null |
| 82 | + Expand-Archive -Path winpython.zip -DestinationPath "C:\depthai-core\winpython" |
| 83 | + $PYROOT = "C:\depthai-core\winpython\WPy64-31700\python\" |
| 84 | + C:\depthai-core\winpython\WPy64-31700\python\python.exe -m venv venv |
| 85 | + .\venv\Scripts\Activate.ps1 |
| 86 | + python -c "import sys; print('using:', sys.executable)" |
| 87 | + pip install --upgrade pip |
| 88 | + pip install numpy pytest pytest-html |
| 89 | + $buildDir = 'C:/depthai-core/build' |
| 90 | + $overlay = 'C:/depthai-core/cmake/triplets/release' # make it absolute |
| 91 | + $isPR = "${{ github.head_ref }}" -ne "" |
| 92 | + $extraFlags = "" |
| 93 | +
|
| 94 | + # Base args |
| 95 | + $cmakeArgs = @( |
| 96 | + '-S','.', |
| 97 | + '-B', $buildDir, |
| 98 | + '-DCMAKE_BUILD_TYPE=Release', |
| 99 | + '-DDEPTHAI_VCPKG_INTERNAL_ONLY=OFF', |
| 100 | + "-DVCPKG_OVERLAY_TRIPLETS=$overlay", |
| 101 | + '-DDEPTHAI_BUILD_TESTS=ON' |
| 102 | + ) |
| 103 | +
|
| 104 | + # Conditionally add extras (only on non-PR builds) |
| 105 | + if (-not $isPR) { |
| 106 | + $cmakeArgs += @( |
| 107 | + '-DDEPTHAI_BUILD_EXAMPLES=ON', |
| 108 | + '-DDEPTHAI_BUILD_PYTHON=ON', |
| 109 | + '-DDEPTHAI_PYTHON_ENABLE_TESTS=ON', |
| 110 | + '-DDEPTHAI_TEST_EXAMPLES=ON', |
| 111 | + '-DDEPTHAI_PYTHON_TEST_EXAMPLES=ON', |
| 112 | + '-DDEPTHAI_PYTHON_ENABLE_EXAMPLES=ON' |
| 113 | + ) |
| 114 | + } |
| 115 | +
|
| 116 | + # Show & run |
| 117 | + Write-Host "cmake args:`n$($cmakeArgs -join ' ')" |
| 118 | + & cmake @cmakeArgs |
| 119 | +
|
| 120 | + $cmakeBuildCommand = "cmake --build C:/depthai-core/build --parallel 2 --config Release" |
| 121 | + Write-Host "Running: $cmakeBuildCommand" |
| 122 | + Invoke-Expression $cmakeBuildCommand |
| 123 | +
|
| 124 | + - name: Upload artifact |
| 125 | + if: steps.reuse.outputs.skip_build != 'true' |
| 126 | + id: artifact-upload-step |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: depthai-core-win-${{ github.sha }} |
| 130 | + path: C:\depthai-core |
| 131 | + retention-days: 1 |
| 132 | + |
| 133 | + run_windows_tests_rvc4: |
| 134 | + needs: [build_windows_tests] |
| 135 | + strategy: |
| 136 | + matrix: |
| 137 | + rvc4os: ${{ fromJson(inputs.luxonis_os_versions_to_test) }} |
| 138 | + fail-fast: false |
| 139 | + runs-on: ['self-hosted', 'testbed-runner'] |
| 140 | + steps: |
| 141 | + |
| 142 | + - name: Run RVC4 tests |
| 143 | + run: | |
| 144 | + source scripts/hil/prepare_hil_framework.sh ${{ secrets.HIL_PAT_TOKEN }} |
| 145 | + export RESERVATION_NAME="https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID#rvc4-windows-${{ matrix.rvc4os }}" |
| 146 | + exec hil --models "oak4_pro or oak4_d" -os windows --reservation-name $RESERVATION_NAME --wait --rvc4-os-version ${{ matrix.rvc4os }} --commands "rmdir /S /Q depthai-core & git clone https://github.com/luxonis/depthai-core.git && cd depthai-core && git fetch origin ${{ github.sha }} && git checkout ${{ github.sha }} && scripts\hil\get_artifacts_and_run_tests.cmd \"${{ github.repository }}\" \"${{ github.token }}\" \"C:\depthai-core\" \"${{ needs.build_windows_tests.outputs.artifact_id }}\"" |
0 commit comments