Skip to content

Commit 59da657

Browse files
authored
Merge pull request #1123 from luxonis/feat/migrate_to_ak
Switch wheel uploading to AK
2 parents e901dc5 + 431ad09 commit 59da657

4 files changed

Lines changed: 87 additions & 69 deletions

File tree

.github/workflows/main.yml

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
needs: build-docstrings
6868
strategy:
6969
matrix:
70-
os: [ubuntu-latest, windows-latest, macos-14]
70+
os: [ubuntu-latest, windows-2022, macos-14]
7171
runs-on: ${{ matrix.os }}
7272
steps:
7373
- name: Print home directory
@@ -78,13 +78,13 @@ jobs:
7878
with:
7979
cmake-version: '3.29.x'
8080
- name: Cache .hunter folder
81-
if: matrix.os != 'windows-latest'
81+
if: matrix.os != 'windows-2022'
8282
uses: actions/cache@v4
8383
with:
8484
path: ~/.hunter/
8585
key: hunter-pytest-${{ matrix.os }}
8686
- name: Cache .hunter folder
87-
if: matrix.os == 'windows-latest'
87+
if: matrix.os == 'windows-2022'
8888
uses: actions/cache@v4
8989
with:
9090
path: C:/.hunter/
@@ -136,7 +136,11 @@ jobs:
136136
needs: build-docstrings
137137
strategy:
138138
matrix:
139-
rpi-os: [rpi-bullseye, rpi-bookworm]
139+
include:
140+
- rpi-os: rpi-bullseye
141+
auditwheel-plat: manylinux_2_31_armv7l
142+
- rpi-os: rpi-bookworm
143+
auditwheel-plat: linux_armv7l
140144
runs-on: ${{ matrix.rpi-os }}
141145
steps:
142146
- name: Print home directory
@@ -160,7 +164,7 @@ jobs:
160164
- name: Auditing wheels and adding armv6l tag (Running on RPi, binaries compiled as armv6l)
161165
run: |
162166
# python3 -m pip install -U wheel auditwheel # Called once when setting up the runner
163-
for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat linux_armv7l -w wheelhouse/preaudited/; done
167+
for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat ${{ matrix.auditwheel-plat }} -w wheelhouse/preaudited/; done
164168
for whl in wheelhouse/preaudited/*.whl; do python3 -m wheel tags --platform-tag +linux_armv6l "$whl"; done
165169
mkdir -p wheelhouse/audited/
166170
for whl in wheelhouse/preaudited/*linux_armv6l*.whl; do cp "$whl" wheelhouse/audited/$(basename $whl); done
@@ -169,19 +173,10 @@ jobs:
169173
with:
170174
name: audited-wheels-${{ matrix.rpi-os }}
171175
path: wheelhouse/audited/
172-
- name: Deploy wheels to artifactory (if not a release)
173-
if: startsWith(github.ref, 'refs/tags/v') != true
174-
run: bash ./ci/upload-artifactory.sh
175-
env:
176-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
177-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
178-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
179-
180-
181176
# This job builds wheels for Windows x86_64 arch
182177
build-windows-x86_64:
183178
needs: build-docstrings
184-
runs-on: windows-latest
179+
runs-on: windows-2022
185180
strategy:
186181
matrix:
187182
python-version: [3.9, '3.10', '3.11', '3.12', '3.13', '3.14']
@@ -232,14 +227,6 @@ jobs:
232227
with:
233228
name: audited-wheels-windows-${{ matrix.python-version }}-${{ matrix.python-architecture }}
234229
path: wheelhouse/audited/
235-
- name: Deploy wheels to artifactory (if not a release)
236-
if: startsWith(github.ref, 'refs/tags/v') != true
237-
run: bash ./ci/upload-artifactory.sh
238-
env:
239-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
240-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
241-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
242-
243230
# This job builds wheels for macOS x86_64 arch
244231
build-macos:
245232
needs: build-docstrings
@@ -293,14 +280,6 @@ jobs:
293280
with:
294281
name: audited-wheels-macos-${{ matrix.python-version }}-${{ matrix.os }}
295282
path: wheelhouse/audited/
296-
- name: Deploy wheels to artifactory (if not a release)
297-
if: startsWith(github.ref, 'refs/tags/v') != true
298-
run: bash ./ci/upload-artifactory.sh
299-
env:
300-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
301-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
302-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
303-
304283
# This job builds wheels for x86_64 arch
305284
build-linux-x86_64:
306285
needs: build-docstrings
@@ -358,14 +337,6 @@ jobs:
358337
with:
359338
name: audited-wheels-linux-x86_64
360339
path: wheelhouse/audited/
361-
- name: Deploy wheels to artifactory (if not a release)
362-
if: startsWith(github.ref, 'refs/tags/v') != true
363-
run: bash ./ci/upload-artifactory.sh
364-
env:
365-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
366-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
367-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
368-
369340
# This job builds wheels for ARM64 arch
370341
build-linux-arm64:
371342
needs: build-docstrings
@@ -415,13 +386,24 @@ jobs:
415386
with:
416387
name: audited-wheels-linux-arm64
417388
path: wheelhouse/audited/
418-
- name: Deploy wheels to artifactory (if not a release)
419-
if: startsWith(github.ref, 'refs/tags/v') != true
420-
run: bash ./ci/upload-artifactory.sh
389+
upload-wheels-to-ak:
390+
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && !startsWith(github.ref, 'refs/tags/v')
391+
needs: [build-linux-armhf, build-windows-x86_64, build-macos, build-linux-x86_64, build-linux-arm64]
392+
runs-on: ubuntu-latest
393+
steps:
394+
- uses: actions/checkout@v4
395+
with:
396+
submodules: 'recursive'
397+
- uses: actions/download-artifact@v4
398+
with:
399+
pattern: audited-wheels*
400+
merge-multiple: true
401+
path: wheelhouse/audited/
402+
- name: Upload wheels to Artifact Keeper
403+
run: bash ./ci/upload-ak.sh --snapshot
421404
env:
422-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
423-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
424-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
405+
AK_URL: ${{ secrets.AK_URL }}
406+
AK_TOKEN: ${{ secrets.AK_TOKEN }}
425407

426408
release:
427409
if: startsWith(github.ref, 'refs/tags/v')
@@ -458,7 +440,7 @@ jobs:
458440
459441
draft: true
460442

461-
# Deploy to PyPi and Artifactory. Only when a commit is tagged
443+
# Deploy to PyPi and Artifact Keeper. Only when a commit is tagged
462444
deploy:
463445
if: startsWith(github.ref, 'refs/tags/v')
464446
needs: [release]
@@ -480,12 +462,11 @@ jobs:
480462
PYPI_SERVER: ${{ secrets.PYPI_SERVER }}
481463
PYPI_USER: ${{ secrets.PYPI_USER }}
482464
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
483-
- name: Run deploy to Artifactory
484-
run: bash ./ci/upload-artifactory-release.sh
465+
- name: Run deploy to Artifact Keeper
466+
run: bash ./ci/upload-ak.sh --release
485467
env:
486-
ARTIFACTORY_URL: ${{ secrets.ARTIFACTORY_URL }}
487-
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
488-
ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }}
468+
AK_URL: ${{ secrets.AK_URL }}
469+
AK_TOKEN: ${{ secrets.AK_TOKEN }}
489470

490471

491472
# notify_hil_workflow_linux_x86_64:

ci/upload-ak.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
: "${AK_URL:?AK_URL must be set}"
5+
: "${AK_TOKEN:?AK_TOKEN must be set}"
6+
7+
case "$1" in
8+
--snapshot)
9+
AK_REPO="luxonis-python-snapshot-local"
10+
;;
11+
--release)
12+
AK_REPO="luxonis-python-release-local"
13+
;;
14+
*)
15+
echo "Error: Unknown option $1"
16+
echo "Usage: $0 [--snapshot | --release]"
17+
exit 1
18+
;;
19+
esac
20+
21+
AK_BASE_URL="${AK_URL%/}"
22+
AK_PYPI_REPOSITORY_URL="${AK_BASE_URL}/pypi/${AK_REPO}/"
23+
AK_PYPI_SIMPLE_URL="${AK_BASE_URL}/pypi/${AK_REPO}/simple/depthai/"
24+
25+
python3 -m pip install -U pip
26+
python3 -m pip install -U twine
27+
python3 -m pip install -U packaging
28+
29+
shopt -s nullglob
30+
wheels=(wheelhouse/audited/*.whl)
31+
if [ "${#wheels[@]}" -eq 0 ]; then
32+
echo "No wheels found in wheelhouse/audited/"
33+
exit 1
34+
fi
35+
36+
for wheel in "${wheels[@]}"; do
37+
echo "Uploading ${wheel}"
38+
python3 -m twine upload \
39+
--repository-url "${AK_PYPI_REPOSITORY_URL}" \
40+
--username "__token__" \
41+
--password "${AK_TOKEN}" \
42+
"${wheel}"
43+
done
44+
45+
index_html="$(mktemp)"
46+
trap 'rm -f "${index_html}"' EXIT
47+
curl -fsSL "${AK_PYPI_SIMPLE_URL}" -o "${index_html}"
48+
49+
for wheel in "${wheels[@]}"; do
50+
wheel_name="$(basename "${wheel}")"
51+
if ! grep -Fq "${wheel_name}" "${index_html}"; then
52+
echo "Uploaded wheel is missing from the PyPI simple index: ${wheel_name}"
53+
exit 1
54+
fi
55+
done

ci/upload-artifactory-release.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/upload-artifactory.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)