forked from eclipse-cyclonedds/cyclonedds-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Add CI Infrastructure #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
julianadrianheine
merged 2 commits into
releases/tri/0.10.5
from
julianadrianheine/enable_ci
Jul 3, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "releases/tri/0.10.5" | ||
| pull_request: | ||
| branches: | ||
| - "releases/tri/0.10.5" | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - python-tag: py311 | ||
| python-version: "3.11" | ||
| - python-tag: py312 | ||
| python-version: "3.12" | ||
|
|
||
| name: Test (Python ${{ matrix.python-version }}) | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| # Build a manylinux wheel using cibuildwheel inside Docker. This handles | ||
| # the full from-source build of the cyclonedds C library so the runner | ||
| # does not need it installed system-wide. The resulting wheel bundles | ||
| # libddsc and can be installed like any normal Python package. | ||
| - name: Build wheel | ||
| if: steps.cache-wheel.outputs.cache-hit != 'true' | ||
| run: bash wheelhouse/build_cyclonedds_wheel.sh ${{ matrix.python-tag }} wheelhouse/ | ||
|
|
||
| - name: Set up venv and install dependencies | ||
| run: | | ||
| python3 -m venv .venv | ||
| .venv/bin/pip install --quiet --upgrade pip | ||
| .venv/bin/pip install --quiet wheelhouse/cyclonedds-*.whl | ||
| .venv/bin/pip install --quiet -r requirements-dev.txt | ||
|
|
||
| - name: Run tests | ||
| run: .venv/bin/python local-ci.py --no-linter | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Test dependencies for CI and local development. | ||
| # | ||
| # These are installed into the venv alongside the pre-built cyclonedds wheel | ||
| # (see wheelhouse/build_cyclonedds_wheel.sh and .github/workflows/ci.yml). | ||
| # They are kept here as a standalone file so that CI can install them without | ||
| # triggering a source build of the package (which requires the cyclonedds C | ||
| # library). The same packages are listed under extras_require["dev"] in | ||
| # setup.py, but that path is only usable when building from source. | ||
| pytest>=6.2 | ||
|
frneer marked this conversation as resolved.
|
||
| pytest-cov | ||
| pytest-mock | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| *.whl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| #!/usr/bin/env bash | ||
| # Build a cyclonedds==0.10.5 manylinux wheel for a given Python version and | ||
| # copy it into this directory. | ||
| # | ||
| # Usage: | ||
| # ./build_cyclonedds_wheel.sh <python-tag> [output-dir] | ||
| # | ||
| # Arguments: | ||
| # python-tag : py311 or py312 | ||
| # output-dir : destination for the wheel (default: this directory) | ||
| # | ||
| # Examples: | ||
| # ./build_cyclonedds_wheel.sh py311 | ||
| # ./build_cyclonedds_wheel.sh py312 /tmp/out | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Pinned cibuildwheel version and manylinux image digest for bit-for-bit | ||
| # reproducible builds. Update both together when intentionally upgrading. | ||
| CIBUILDWHEEL_VERSION="3.4.1" | ||
| MANYLINUX_IMAGE="quay.io/pypa/manylinux_2_28_x86_64@sha256:853663dc8253b62be437bb52a5caecffd020792af4442f55d927d22e0ea795ae" | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" | ||
|
|
||
| if [[ $# -lt 1 || $# -gt 2 ]]; then | ||
| echo "Usage: $0 <python-tag> [output-dir] (e.g. py311 or py312)" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| PYTHON_TAG="$1" | ||
| OUTPUT_DIR="${2:-$SCRIPT_DIR}" | ||
| # Convert "py311" -> "cp311" | ||
| CP_TAG="cp${PYTHON_TAG#py}" | ||
| BUILD_ID="${CP_TAG}-manylinux_x86_64" | ||
|
|
||
| # Fix the umask so git creates files with deterministic permissions (0644/0755) | ||
| # regardless of the caller's umask. Without this, Bazel's test runner uses a | ||
| # different umask than a regular shell, causing pip to record different Unix | ||
| # permission bits in the wheel ZIP and producing a different archive SHA. | ||
| umask 0022 | ||
|
|
||
| cd "${REPO_ROOT}" | ||
|
|
||
| # Freeze build timestamps to the source commit time for deterministic output. | ||
| SOURCE_DATE_EPOCH="$(git show -s --format=%ct HEAD)" | ||
| export SOURCE_DATE_EPOCH | ||
|
|
||
| WORK_DIR="$(mktemp -d)" | ||
| trap 'rm -rf "$WORK_DIR"' EXIT | ||
|
|
||
| echo "==> Setting up venv and installing cibuildwheel ${CIBUILDWHEEL_VERSION} ..." | ||
| python3 -m venv "${WORK_DIR}/.venv" | ||
| "${WORK_DIR}/.venv/bin/pip3" install --quiet "cibuildwheel==${CIBUILDWHEEL_VERSION}" | ||
|
|
||
| echo "==> Building wheel for ${PYTHON_TAG} (${BUILD_ID}) ..." | ||
| # These variables pin the build environment (container image, dependency | ||
| # versions, timestamps) to produce a bit-for-bit reproducible wheel SHA. | ||
| # Changing or removing any of them will change the output wheel and require | ||
| # rebuilding and recommitting the wheels in this directory. | ||
| CIBW_MANYLINUX_X86_64_IMAGE="${MANYLINUX_IMAGE}" \ | ||
| CIBW_ENVIRONMENT_PASS="SOURCE_DATE_EPOCH" \ | ||
| CIBW_TEST_COMMAND="" \ | ||
| CIBW_DEPENDENCY_VERSIONS="pinned" \ | ||
| "${WORK_DIR}/.venv/bin/cibuildwheel" --output-dir "${WORK_DIR}/wheelhouse" --only "${BUILD_ID}" | ||
|
|
||
| WHEEL="$(ls "${WORK_DIR}/wheelhouse"/*.whl)" | ||
| WHEEL_BASENAME="$(basename "$WHEEL")" | ||
|
|
||
| echo "==> Copying ${WHEEL_BASENAME} -> ${OUTPUT_DIR}/" | ||
| cp "$WHEEL" "${OUTPUT_DIR}/" | ||
| echo "==> Done: ${OUTPUT_DIR}/${WHEEL_BASENAME}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| To rebuild and commit the wheels, run the build script for each Python version | ||
| and commit the results: | ||
|
|
||
| ```bash | ||
| bash wheelhouse/build_cyclonedds_wheel.sh py311 wheelhouse/ | ||
| bash wheelhouse/build_cyclonedds_wheel.sh py312 wheelhouse/ | ||
| git add wheelhouse/*.whl | ||
| git commit -m "Rebuild cyclonedds wheels" | ||
| ``` | ||
|
|
||
| Notes: | ||
| 1. The pinned version (0.10.5) matches the cyclonedds version shipped with | ||
| ROS 2 Jazzy: https://index.ros.org/p/cyclonedds/#jazzy | ||
| 2. This package is a Python binding of the underlying C `cyclonedds` binary. | ||
| `cibuildwheel` bundles the necessary shared libraries into the wheel so | ||
| consumers do not need to install cyclonedds separately. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.