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
3 changes: 2 additions & 1 deletion .github/skills/testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Labels include `unit`, `e2e`, `partitions`, `perf`, `benchmark`, `cft_scenario`,
`cft_model_test` runs the same scenarios with the [consensus model driver](../../../tests/cft_model/README.md), which binds their commands to the Lean model of the protocol and not to the implementation.
CMake registers it only when configured with `-DCFT_MODEL_DRIVER=ON`.

The release workflow sets `CCF_USE_RELEASED_PYTHON_PACKAGE=1` so `tests.sh`, installed-package tests, and sandboxes install the latest released `ccf` package from PyPI with `uv pip install --upgrade --reinstall-package ccf ccf`, replacing any previously installed editable SDK.
The release workflow sets `CCF_USE_RELEASED_PYTHON_PACKAGE=1` and derives `CCF_PYTHON_PACKAGE_MAX_VERSION` from the build's `VERSION_LONG`, normalized to a public Python version.
With this flag, `tests.sh`, installed-package tests, and sandboxes install the latest published `ccf` package from PyPI no newer than that upper bound, including prereleases, replacing any previously installed editable SDK.
Without this flag, development and normal CI tests retain their editable local SDK installation.
Installed sandboxes still default to the SDK version matching the installed CCF release.
An existing caller-supplied `VENV_DIR` is reused without reinstalling packages; `tests.sh` selects the SDK before exporting its environment to child sandboxes.
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ The release therefore does not test that the RPM is reproducible, and does not p

Python packages are built and published separately by the [OneBranch pipeline](../../.pipelines/README.md), without attestations.

Release-build tests, installed-package tests, and the recovery benchmark use the latest released `ccf` Python package from PyPI. The release job sets `CCF_USE_RELEASED_PYTHON_PACKAGE=1`; normal development and CI tests continue to use the local package.
Release-build tests, installed-package tests, and the recovery benchmark use the latest published `ccf` Python package from PyPI no newer than the CCF version under test, including prereleases.
Older-major SDKs are eligible, but newer SDKs are not.
The release job sets `CCF_USE_RELEASED_PYTHON_PACKAGE=1`; normal development and CI tests continue to use the local package.

File: `release.yml`
3rd party dependencies: None
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ jobs:
cmake -GNinja -DCLIENT_PROTOCOLS_TEST=ON -DCMAKE_BUILD_TYPE=Release ..
ninja -v | tee build.log

- name: "Set Python SDK upper bound"
shell: bash
run: |
set -exo pipefail
version=$(uv run --no-project --with packaging python scripts/derive_python_version.py --public "$(<build/VERSION_LONG)")
echo "CCF_PYTHON_PACKAGE_MAX_VERSION=$version" >> "$GITHUB_ENV"

- name: "Test"
run: |
set -ex
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The proxy and its package-download destinations must be reachable under OneBranc

This pipeline is the only Python package publisher.
GitHub Actions no longer builds, attaches, or publishes Python wheels as part of the main CCF release.
Release-build tests use the latest package already released on PyPI; normal development and CI tests continue to use the local package.
Release-build tests use the latest package already published on PyPI no newer than the CCF version under test, including prereleases; normal development and CI tests continue to use the local package.

Attestation is disabled for Python packages published to PyPI.
A GitHub workflow that downloads an already-built wheel cannot establish OneBranch build provenance.
Expand Down
8 changes: 8 additions & 0 deletions scripts/derive_python_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def main() -> None:
"tag",
help="CCF release tag, optionally prefixed with refs/tags/.",
)
parser.add_argument(
"--public",
action="store_true",
help="Discard local version suffixes, for SDK compatibility bounds.",
)
args = parser.parse_args()

tag = args.tag.removeprefix("refs/tags/")
Expand All @@ -28,6 +33,9 @@ def main() -> None:
version = to_python_version(tag)
except ValueError as exc:
parser.error(str(exc))
if args.public:
print(version.public)
return
Comment thread
achamayou marked this conversation as resolved.
Resolved
if version.local is not None:
parser.error(f"PyPI does not accept local versions: {version}")
print(version)
Expand Down
8 changes: 4 additions & 4 deletions tests/sandbox/sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ if [ ! -f "${VENV_DIR}/bin/activate" ]; then
fi

if [[ "${CCF_USE_RELEASED_PYTHON_PACKAGE:-0}" == "1" ]]; then
echo "Installing latest released ccf package..."
uv pip install -q --upgrade --reinstall-package ccf ccf
echo "Installing latest published ccf package no newer than ${CCF_PYTHON_PACKAGE_MAX_VERSION:?Set the CCF version under test}, including prereleases..."
uv pip install -q --upgrade --reinstall-package ccf --prerelease allow "ccf<=${CCF_PYTHON_PACKAGE_MAX_VERSION}"
elif [ -f "${VERSION_FILE}" ]; then
VERSION=$(<"${VERSION_FILE}")
VERSION=${VERSION#"ccf-"}
Expand Down Expand Up @@ -111,8 +111,8 @@ else
# shellcheck disable=SC1090
source "${VENV_DIR}/bin/activate"
if [[ "${CCF_USE_RELEASED_PYTHON_PACKAGE:-0}" == "1" && -z "$venv_dir_supplied" ]]; then
echo "Installing latest released ccf package..."
uv pip install -q --upgrade --reinstall-package ccf ccf
echo "Installing latest published ccf package no newer than ${CCF_PYTHON_PACKAGE_MAX_VERSION:?Set the CCF version under test}, including prereleases..."
uv pip install -q --upgrade --reinstall-package ccf --prerelease allow "ccf<=${CCF_PYTHON_PACKAGE_MAX_VERSION}"
fi
echo "Python environment already setup under ${VENV_DIR}"
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bash "$INSTALL_PREFIX"/bin/install_uv.sh "$PWD"/env/bin
# shellcheck source=/dev/null
source env/bin/activate
if [[ "${CCF_USE_RELEASED_PYTHON_PACKAGE:-0}" == "1" ]]; then
uv pip install --upgrade --reinstall-package ccf ccf
uv pip install --upgrade --reinstall-package ccf --prerelease allow "ccf<=${CCF_PYTHON_PACKAGE_MAX_VERSION:?Set the CCF version under test}"
else
uv pip install -e ../../../python
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -n "${PIP_INDEX_URL:-}" ] && [ -z "${UV_INDEX_URL:-}" ]; then
export UV_INDEX_URL="$PIP_INDEX_URL"
fi
if [[ "${CCF_USE_RELEASED_PYTHON_PACKAGE:-0}" == "1" ]]; then
uv pip install -q --upgrade --reinstall-package ccf ccf
uv pip install -q --upgrade --reinstall-package ccf --prerelease allow "ccf<=${CCF_PYTHON_PACKAGE_MAX_VERSION:?Set the CCF version under test}"
else
uv pip install -q -e ../python/
fi
Expand Down