Skip to content

ci: run integration tests against N, N-1, N-2 Dapr runtime versions#1091

Open
ashoksmore wants to merge 3 commits into
dapr:mainfrom
ashoksmore:feature/version-compat-matrix
Open

ci: run integration tests against N, N-1, N-2 Dapr runtime versions#1091
ashoksmore wants to merge 3 commits into
dapr:mainfrom
ashoksmore:feature/version-compat-matrix

Conversation

@ashoksmore

Copy link
Copy Markdown

Description

Updates run-tests.yaml to validate SDK compatibility against Dapr runtime versions N, N-1, and N-2 per the SDK compatibility policy.

Changes:

  • Adds a prepare job that reads the SDK VERSION and derives three runtime minors
  • Resolves the latest patch (or RC if stable is unavailable) for each minor from dapr/dapr releases
  • Expands the validate job matrix to run existing integration and example tests for each runtime × Python version (3.10-3.14)
  • Passes explicit version to setup-dapr-runtime instead of always using the latest runtime

The same workflow file should work on backported release branches without modification.

Issue reference

Fixes #1067

Checklist

  • Code compiles correctly: CI workflow change only; build.yaml lint/unit checks apply
  • Created/updated tests: Reuses existing tests/integration/ and tests/examples/ suites across runtime matrix (no new test files; coverage is via CI matrix)
  • Extended the documentation: Not required for this CI-only maintenance change

@ashoksmore ashoksmore requested review from a team as code owners June 13, 2026 06:30
Signed-off-by: Ashok More <ashoksmore7@gmail.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.06452% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.92%. Comparing base (bffb749) to head (c0810bd).
⚠️ Report is 149 commits behind head on main.

Files with missing lines Patch % Lines
tools/compute_compat_matrix.py 58.06% 39 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1091      +/-   ##
==========================================
- Coverage   86.63%   81.92%   -4.71%     
==========================================
  Files          84      117      +33     
  Lines        4473     9671    +5198     
==========================================
+ Hits         3875     7923    +4048     
- Misses        598     1748    +1150     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sicoyle sicoyle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is amazing - thank you!!! could you pls mv the python script into its own py file that we can then test and run locally more easily?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the CI workflow to validate the Python SDK against the Dapr runtime compatibility window (N, N-1, N-2) by dynamically computing a runtime-version test matrix from the SDK version and dapr/dapr GitHub releases.

Changes:

  • Adds a prepare job that computes a compatibility matrix (Python 3.10–3.14 × runtime patch versions for N/N-1/N-2).
  • Updates validate to consume the computed matrix and run integration + example test suites per runtime version.
  • Pins setup-dapr-runtime to an explicit runtime version per matrix entry (instead of always using “latest”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 39 to 43
run: |
if [ ${{ github.event.client_payload.command }} = "ok-to-test" ]; then
echo "CHECKOUT_REPO=${{ github.event.client_payload.pull_head_repo }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=${{ github.event.client_payload.pull_head_ref }}" >> $GITHUB_ENV
fi
Comment on lines 134 to 138
run: |
CLI_VERSION=$(curl -fsS -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/dapr/cli/releases?per_page=10" | \
jq -r 'map(select(.prerelease == false)) | sort_by(.created_at) | reverse | .[0].tag_name | ltrimstr("v")')
if [ -z "$CLI_VERSION" ] || [ "$CLI_VERSION" = "null" ]; then
echo "Failed to resolve Dapr CLI version" && exit 1
if [ ${{ github.event.client_payload.command }} = "ok-to-test" ]; then
echo "CHECKOUT_REPO=${{ github.event.client_payload.pull_head_repo }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=${{ github.event.client_payload.pull_head_ref }}" >> $GITHUB_ENV
fi
Comment thread .github/workflows/run-tests.yaml Outdated
Comment on lines +81 to +92
def latest_patch(runtime_minor: str) -> str | None:
prefix = f'{runtime_minor}.'
for prerelease in (False, True):
versions = [
release['tag_name'].removeprefix('v')
for release in releases
if release.get('prerelease') == prerelease
and release['tag_name'].removeprefix('v').startswith(prefix)
]
if versions:
return sorted(versions, key=version_key)[-1]
return None
Comment thread .github/workflows/run-tests.yaml Outdated
Comment on lines +95 to +110
matrix_include = []
for runtime_minor in runtime_minors:
runtime_version = latest_patch(runtime_minor)
if runtime_version is None:
print(f'Warning: no Dapr runtime release found for {runtime_minor}, skipping')
continue
for python_version in python_versions:
matrix_include.append(
{
'python_ver': python_version,
'runtime_version': runtime_version,
}
)

if not matrix_include:
raise SystemExit('No Dapr runtime releases found for compatibility matrix')
@acroca

acroca commented Jun 18, 2026

Copy link
Copy Markdown
Member

@ashoksmore Great idea! I was thinking this is potentially useful for other dapr repos too, so I think it'd a good idea to make it reusable.
We could create a new action in https://github.com/dapr/.github/tree/main/.github/actions (this is the repo where we have hared actions and workflows for various dapr repos) that just returns the latest 3 dapr minor versions as an output.
This new action would be then used together with the setup-dapr-runtime like you did in this PR, something like this:

  jobs:
    versions:
      runs-on: ubuntu-latest
      outputs:
        versions: ${{ steps.v.outputs.versions }}    # ["1.18.2","1.17.5","1.16.8"]
      steps:
        - id: v
          uses: dapr/.github/.github/actions/dapr-versions@main
    test:
      needs: versions
      strategy:
        matrix:
          version: ${{ fromJson(needs.versions.outputs.versions) }}
      steps:
        - uses: dapr/.github/.github/actions/setup-dapr-cli@main
          with: { version: ${{ matrix.version }} }

What do you think?

Signed-off-by: Ashok More <ashoksmore7@gmail.com>
@ashoksmore

Copy link
Copy Markdown
Author

@sicoyle Thanks for your review. I've addressed your feedback. Matrix logic is in tools/compute_compat_matrix.py with unit tests in tests/test_compute_compat_matrix.py.
Ready for another look when you have time, thanks!

@ashoksmore ashoksmore requested a review from sicoyle June 22, 2026 19:20
@ashoksmore

Copy link
Copy Markdown
Author

Hi @acroca, thanks for the suggestion on a shared dapr-versions action in dapr/.github. That makes a lot of sense for reuse across repos.

I kept this PR focused on the python-sdk script per @sicoyle’s feedback, but I’d be happy to help on a follow-up PR in dapr/.github if that’s the direction you’d like to go. Let me know what you prefer.

@acroca

acroca commented Jun 30, 2026

Copy link
Copy Markdown
Member

Hey @ashoksmore, I really like the initiative here, but I think there's a gap in the core approach we should sort out before it lands.

The matrix runs the existing tests/integration and tests/examples suites unchanged against N, N-1 and N-2. The problem is those suites already include tests for APIs that only exist in recent runtimes, like conversation (the Llama setup step), jobs, mcp, workflow, crypto and distributed-lock. Running them against 1.17 (which is what N-2 resolves to today, with VERSION at 1.19.0.dev) they'll fail just because the feature didn't exist yet, not because anything regressed. Right now there's no mechanism in the repo to skip a test by runtime version, so the matrix would be red from day one.

The thing we need to solve is making a red job mean something, so it tells us "we broke a supported runtime" and not "this feature is newer than that runtime". The way I read the N-2 guarantee is that existing behavior keeps working on older runtimes, not that new features work on them, but it'd be good to agree on that explicitly.

My preference would be minimum runtime markers, something like @pytest.mark.min_runtime("1.15") with a conftest.py hook that reads the runtime version (we can set it as an env in the job, or query /v1.0/metadata) and skips anything above the floor. The nice thing is the set of tests that runs on an older runtime falls out automatically, so there's no separate "core suite" to keep up to date, and each test just declares its floor once. We can also make sure new feature tests carry a marker during review.

One more thing worth putting on the table. This matrix tests the newest SDK against older runtimes. The reverse case, an older SDK against the latest runtime (for example someone on SDK 1.17 upgrading their dapr to 1.19), is probably the more common real world scenario, and it doesn't need any markers because the old tests only touch features that already existed. We could cover that by having the release-1.X branches run their suites against the latest runtime. Pinning release-1.17 to runtime 1.17 specifically isn't worth much, since that pair was already green at release. Not necessarily for this PR, but we should decide which directions we actually want to guarantee.

This is also separate from the shared dapr/.github action idea from before, which is more about where the version resolution lives, so both can land. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add test coverage for sdk running with different runtime versions

4 participants