Skip to content

Commit 55d853b

Browse files
committed
Testing to add download of wheels
1 parent 5cee89a commit 55d853b

File tree

1 file changed

+148
-1
lines changed

1 file changed

+148
-1
lines changed

.github/workflows/python-main.yml

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,46 @@ jobs:
361361
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
362362
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
363363
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
364-
364+
- name: Append build hash if not a tagged commit
365+
if: startsWith(github.ref, 'refs/tags/v') != true
366+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
367+
- name: Install from Artifactory and smoke-test (macOS)
368+
if: startsWith(github.ref, 'refs/tags/v') != true
369+
env:
370+
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
371+
run: |
372+
set -euo pipefail
373+
374+
# Resolve the exact dev version (includes commit hash)
375+
ver=$(python -c "import os,sys,pathlib; sys.path.insert(0, str(pathlib.Path('bindings/python').resolve())); import find_version as v; print(v.get_package_dev_version(os.environ['BUILD_COMMIT_HASH']))")
376+
echo "Installing depthai==$ver using $(python -V)"
377+
378+
# Install from Artifactory snapshot
379+
python -m pip install -U pip
380+
python -m pip uninstall -y depthai || true
381+
python -m pip install -U --prefer-binary \
382+
--extra-index-url "$ARTIFACTORY_URL/luxonis-python-snapshot-local" \
383+
"depthai==$ver" \
384+
--trusted-host 3.145.46.25
385+
386+
# Smoke test: fail hard on any exception or version mismatch
387+
ver="$ver" "$PYBIN" - <<'PY'
388+
import os, sys, traceback, platform
389+
try:
390+
import depthai as dai
391+
except Exception:
392+
traceback.print_exc()
393+
sys.exit(1)
394+
395+
expected = os.environ["ver"] # read the env var you passed in
396+
installed = getattr(dai, "__version__", "<unknown>")
397+
if installed != expected:
398+
print(f"Version mismatch: installed {installed} vs expected {expected}", file=sys.stderr)
399+
sys.exit(1)
400+
401+
print("depthai:", installed)
402+
print("python:", platform.python_version(), "ABI:", sys.implementation.cache_tag)
403+
PY
365404
# This job builds wheels for x86_64 arch
366405
build-linux-x86_64:
367406
needs: build-docstrings
@@ -457,6 +496,48 @@ jobs:
457496
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
458497
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
459498

499+
- name: Append build hash if not a tagged commit
500+
if: startsWith(github.ref, 'refs/tags/v') != true
501+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
502+
503+
- name: Install from Artifactory and smoke-test (manylinux x86_64)
504+
if: startsWith(github.ref, 'refs/tags/v') != true
505+
env:
506+
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
507+
run: |
508+
set -euo pipefail
509+
510+
PYBIN="/opt/python/cp310-cp310/bin/python"
511+
512+
# Resolve the exact dev version (includes commit hash)
513+
ver=$("$PYBIN" -c "import os,sys,pathlib; sys.path.insert(0, str(pathlib.Path('bindings/python').resolve())); import find_version as v; print(v.get_package_dev_version(os.environ['BUILD_COMMIT_HASH']))")
514+
echo "Installing depthai==$ver using $($PYBIN -V)"
515+
516+
# Install from Artifactory snapshot
517+
"$PYBIN" -m ensurepip --upgrade || true
518+
"$PYBIN" -m pip install -U pip
519+
"$PYBIN" -m pip uninstall -y depthai || true
520+
"$PYBIN" -m pip install -U --prefer-binary --extra-index-url "$ARTIFACTORY_URL/luxonis-python-snapshot-local" "depthai==$ver" --trusted-host 3.145.46.25
521+
522+
# Smoke test: fail hard on any exception or version mismatch
523+
ver="$ver" "$PYBIN" - <<'PY'
524+
import os, sys, traceback, platform
525+
try:
526+
import depthai as dai
527+
except Exception:
528+
traceback.print_exc()
529+
sys.exit(1)
530+
531+
expected = os.environ["ver"] # read the env var you passed in
532+
installed = getattr(dai, "__version__", "<unknown>")
533+
if installed != expected:
534+
print(f"Version mismatch: installed {installed} vs expected {expected}", file=sys.stderr)
535+
sys.exit(1)
536+
537+
print("depthai:", installed)
538+
print("python:", platform.python_version(), "ABI:", sys.implementation.cache_tag)
539+
PY
540+
460541
# This job builds wheels for ARM64 arch
461542
build-linux-arm64:
462543
needs: build-docstrings
@@ -556,6 +637,46 @@ jobs:
556637
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
557638
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
558639
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
640+
- name: Append build hash if not a tagged commit
641+
if: startsWith(github.ref, 'refs/tags/v') != true
642+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
643+
- name: Install from Artifactory and smoke-test (manylinux aarch64)
644+
if: startsWith(github.ref, 'refs/tags/v') != true
645+
env:
646+
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
647+
run: |
648+
set -euo pipefail
649+
650+
PYBIN="/opt/python/cp310-cp310/bin/python"
651+
652+
# Resolve the exact dev version (includes commit hash)
653+
ver=$("$PYBIN" -c "import os,sys,pathlib; sys.path.insert(0, str(pathlib.Path('bindings/python').resolve())); import find_version as v; print(v.get_package_dev_version(os.environ['BUILD_COMMIT_HASH']))")
654+
echo "Installing depthai==$ver using $($PYBIN -V)"
655+
656+
# Install from Artifactory snapshot
657+
"$PYBIN" -m ensurepip --upgrade || true
658+
"$PYBIN" -m pip install -U pip
659+
"$PYBIN" -m pip uninstall -y depthai || true
660+
"$PYBIN" -m pip install -U --prefer-binary --extra-index-url "$ARTIFACTORY_URL/luxonis-python-snapshot-local" "depthai==$ver" --trusted-host 3.145.46.25
661+
662+
# Smoke test: fail hard on any exception or version mismatch
663+
ver="$ver" "$PYBIN" - <<'PY'
664+
import os, sys, traceback, platform
665+
try:
666+
import depthai as dai
667+
except Exception:
668+
traceback.print_exc()
669+
sys.exit(1)
670+
671+
expected = os.environ["ver"] # read the env var you passed in
672+
installed = getattr(dai, "__version__", "<unknown>")
673+
if installed != expected:
674+
print(f"Version mismatch: installed {installed} vs expected {expected}", file=sys.stderr)
675+
sys.exit(1)
676+
677+
print("depthai:", installed)
678+
print("python:", platform.python_version(), "ABI:", sys.implementation.cache_tag)
679+
PY
559680
560681
combine-windows-x86_64-wheels:
561682
needs: build-windows-x86_64
@@ -586,6 +707,32 @@ jobs:
586707
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
587708
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
588709
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
710+
- name: Append build hash if not a tagged commit
711+
if: startsWith(github.ref, 'refs/tags/v') != true
712+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
713+
- name: Install from Artifactory and smoke-test (Windows)
714+
if: startsWith(github.ref, 'refs/tags/v') != true
715+
shell: pwsh
716+
env:
717+
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
718+
run: |
719+
$env:PYTHONIOENCODING = 'utf-8'
720+
721+
# Resolve the exact dev version (includes commit hash)
722+
$ver = python -c "import os,sys,pathlib; sys.path.insert(0,str(pathlib.Path('bindings/python').resolve())); import find_version as v; print(v.get_package_dev_version(os.environ['BUILD_COMMIT_HASH']))"
723+
Write-Host "Installing depthai==$ver using:"; python -VV
724+
725+
# Install from Artifactory snapshot
726+
python -m pip install -U pip
727+
python -m pip uninstall -y depthai 2>$null | Out-Null
728+
python -m pip install -U --prefer-binary `
729+
--extra-index-url "$env:ARTIFACTORY_URL/luxonis-python-snapshot-local" `
730+
"depthai==$ver" `
731+
--trusted-host 3.145.46.25
732+
733+
# Smoke test (no heredoc; YAML-safe). Fail on import error or version mismatch.
734+
$env:EXPECTED_VERSION = $ver
735+
python -c "import os,sys,platform; import depthai as d; e=os.environ['EXPECTED_VERSION']; i=getattr(d,'__version__','<unknown>'); assert i==e, f'Version mismatch: {i} vs {e}'; print('depthai:', i); print('python:', platform.python_version(), 'ABI:', sys.implementation.cache_tag)"
589736
590737
release:
591738
if: startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)