Skip to content
Draft
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
81 changes: 81 additions & 0 deletions .github/workflows/compat-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: compatibility suite (V4 plugins)

# The V4 plugin features are not in the pinned suite submodule yet, so this
# checks out the suite branch that adds them and runs
# tests/compatibility_suite/test_v4_plugins.py against it. It runs on draft PRs
# and on PRs to any base, unlike test.yml.
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
suite-repository:
description: pact-compatibility-suite repository with features/V4/plugins
default: YOU54F/pact-compatibility-suite
suite-ref:
description: Ref of that repository to run
default: feat/plugin-features

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

env:
PYTEST_ADDOPTS: --color=yes
FORCE_COLOR: '1'
PACT_DO_NOT_TRACK: 'true'
SUITE_REPOSITORY: ${{ inputs.suite-repository || 'YOU54F/pact-compatibility-suite' }}
SUITE_REF: ${{ inputs.suite-ref || 'feat/plugin-features' }}

jobs:
plugins:
name: V4 plugins (Linux)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: true

- name: Checkout plugin suite
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ env.SUITE_REPOSITORY }}
ref: ${{ env.SUITE_REF }}
path: pact-compatibility-suite-plugins

- name: Set up uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
enable-cache: true

- name: Install Python
run: uv python install 3.11

- name: Install the Pact CLI
uses: pact-foundation/pact-cli@ce8e65692ad3ea9d11244749ae24c8c49225d95f # main

- name: Install plugins
run: |
# matt is not in the plugin repository index, so it is installed from its release.
pact plugin install https://github.com/mefellows/pact-matt-plugin/releases/tag/v0.1.1 -y
pact plugin install csv --version 0.0.6 -y
pact plugin install avro --version 0.1.3 -y
pact plugin install protobuf --version 0.8.0 -y

# grpcio is only in the example group; the gRPC scenarios skip without it.
# pytest-bdd 9.0 uses FixtureManager._arg2fixturedefs, which pytest 9.2 removed.
- name: Run plugin features
env:
PACT_COMPAT_SUITE: ${{ github.workspace }}/pact-compatibility-suite-plugins
run: >-
uv run --python 3.11 --group test --with grpcio --with 'pytest<9.2'
pytest tests/compatibility_suite/test_v4_plugins.py --no-cov -rs
15 changes: 15 additions & 0 deletions tests/compatibility_suite/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,18 @@ def broker_url(request: pytest.FixtureRequest) -> Generator[str, Any, None]:
) as _:
yield "http://pactbroker:pactbroker@localhost:9292"
return


def pytest_bdd_apply_tag(tag: str, function: object) -> bool | None: # noqa: ARG001
"""
Skip turning plugin and transport tags into pytest markers.

The V4 plugin features tag scenarios with `@plugin:<name>` and
`@transport:<name>`, which are not valid marker names.

Returns:
`True` if the tag has been handled, or `None` to use the default.
"""
if tag == "plugin" or tag.startswith(("plugin:", "transport:")):
return True
return None
Loading
Loading