Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: python-sdk

on:
push:
branches:
- '**'


concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
test-bindings:
name: Test python SDK bindings
runs-on:
- self-hosted
- Linux
- X64
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prep calibration files
run: cp /mnt/jenkins/python-sdk-ci-test/calibration_*.json .

- name: Build docker image
run: docker build . --tag ci_rust_$GITHUB_SHA -f ci/Dockerfile

- name: Run tests
run: |
docker run --rm -v /mnt/jenkins/python-sdk-ci-test:/root/Documents/cepton ci_rust_$GITHUB_SHA bash -ex -c '
cd /app
python3 -m unittest discover -s tests
'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ build/
__pycache__/
*.egg-info
*.egg
data/
data/
calibration_*.json
Binary file modified cepton_sdk3/lib/linux-x64/libcepton_sdk2.so
Binary file not shown.
14 changes: 14 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use official Python 3.12 base image
FROM python:3.12-slim


WORKDIR /app

COPY . .
RUN pip install --upgrade pip && pip install .

# Copy all calibration files from the mounted folder into the
# sdk directory so it can find them.
COPY calibration_*.json /app/cepton_sdk3/lib/linux-x64/

CMD ["/bin/bash"]
20 changes: 16 additions & 4 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@
import cepton_sdk3 as sdk


class SdkApiTest(unittest.TestCase):
"""API tests"""
class BasicTests(unittest.TestCase):
"""Basic tests"""

def test_initialize(self):
"""Test initialize and deinitialize"""
sdk.initialize()
sdk.deinitialize()

def test_read_frames(self):
"""No-op"""
def test_replay(self):
"""Test that replay works"""
sdk.initialize()
sdk.enable_frame_fifo(0, 10)
sdk.load_pcap("/root/Documents/cepton/lobby-1.pcap")

frame_counts = []
for _ in range(10):
frame = sdk.frame_fifo_get_frame(2000)
frame_counts.append(frame.positions.shape[0])

self.assertTrue(all(count > 0 for count in frame_counts))

sdk.deinitialize()