From 03cc67c58013b4eb9b0f64196796c6684e5d60e2 Mon Sep 17 00:00:00 2001 From: Bartosz Date: Mon, 7 Sep 2026 17:05:58 +0200 Subject: [PATCH 1/2] Test the example against the SDK main branch. --- .github/workflows/test-develop.yml | 36 ++++++++++++++++++++++++++++++ scripts/set-sdk-version.sh | 32 ++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/test-develop.yml create mode 100755 scripts/set-sdk-version.sh diff --git a/.github/workflows/test-develop.yml b/.github/workflows/test-develop.yml new file mode 100644 index 0000000..03518eb --- /dev/null +++ b/.github/workflows/test-develop.yml @@ -0,0 +1,36 @@ +name: Test against SDK main + +# Exercises the example app against the unreleased Castle Python SDK (main +# branch). This is the permanent test/sdk-develop branch: every push to it runs +# the suite against the latest main. Nightly/manual runs require this file to +# also live on the default branch (GitHub only honours schedule/workflow_dispatch +# from the default branch). +on: + push: + branches: [test/sdk-develop] + workflow_dispatch: + schedule: + - cron: "0 6 * * *" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.13' + + - name: Point the app at the SDK main branch + run: ./scripts/set-sdk-version.sh main + + - run: pip install -r requirements-dev.txt + + - name: Byte-compile sources + run: python -m py_compile app.py castle_config.py demo_config.py + + - name: Run tests + run: pytest diff --git a/scripts/set-sdk-version.sh b/scripts/set-sdk-version.sh new file mode 100755 index 0000000..7c48815 --- /dev/null +++ b/scripts/set-sdk-version.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Point the example app at a specific Castle Python SDK source. +# +# set-sdk-version.sh main -> track the SDK's main branch (pre-release testing) +# set-sdk-version.sh 7.3.0 -> pin the released >=7.3.0,<8 package from PyPI +# +# Rewrites the castle requirement in requirements.txt. +set -euo pipefail + +target="${1:?usage: set-sdk-version.sh }" + +python3 - "$target" <<'PY' +import re +import sys + +target = sys.argv[1] +path = "requirements.txt" +with open(path) as f: + content = f.read() + +if target == "main": + line = "castle @ git+https://github.com/castle/castle-python.git@main" +else: + major = int(target.split(".")[0]) + line = f"castle>={target},<{major + 1}" + +updated, count = re.subn(r"^castle\b.*$", line, content, flags=re.M) +if count == 0: + sys.exit("no castle requirement found in requirements.txt") +with open(path, "w") as f: + f.write(updated) +PY From 11ea4702ec95cf853f233046037f8bbdafbe6fb1 Mon Sep 17 00:00:00 2001 From: Bartosz Date: Mon, 7 Sep 2026 17:16:47 +0200 Subject: [PATCH 2/2] Rename the SDK-main workflow to test-main. --- .github/workflows/{test-develop.yml => test-main.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{test-develop.yml => test-main.yml} (88%) diff --git a/.github/workflows/test-develop.yml b/.github/workflows/test-main.yml similarity index 88% rename from .github/workflows/test-develop.yml rename to .github/workflows/test-main.yml index 03518eb..5cbe898 100644 --- a/.github/workflows/test-develop.yml +++ b/.github/workflows/test-main.yml @@ -1,13 +1,13 @@ name: Test against SDK main # Exercises the example app against the unreleased Castle Python SDK (main -# branch). This is the permanent test/sdk-develop branch: every push to it runs +# branch). This is the permanent test/sdk-main branch: every push to it runs # the suite against the latest main. Nightly/manual runs require this file to # also live on the default branch (GitHub only honours schedule/workflow_dispatch # from the default branch). on: push: - branches: [test/sdk-develop] + branches: [test/sdk-main] workflow_dispatch: schedule: - cron: "0 6 * * *"