Skip to content
Closed
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
88 changes: 88 additions & 0 deletions .github/workflows/test-c2pa-rs-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Receiver for c2pa-python. Install as
# .github/workflows/test-c2pa-rs-branch.yml in contentauth/c2pa-python.
#
# c2pa-python has no `c2pa` Cargo dependency to rewrite: it normally downloads
# prebuilt native artifacts, but the Makefile exposes a `build-from-source`
# path driven by C2PA_RS_PATH. So we re-target by checking out c2pa-rs at the PR
# branch and building against it. There is no committable diff, so this receiver
# is STATUS-ONLY (no draft PR); the status links to this workflow run. A red
# status means a human needs to make changes in c2pa-python.
#
# Requires the CROSS_ORG_PR_TOKEN secret (see contentauth/c2pa-rs
# docs/breaking-change-automation/README.md).

name: Test against c2pa-rs branch

on:
repository_dispatch:
types: [c2pa-rs-breaking-change]

permissions:
contents: read

env:
REPO_NAME: c2pa-python
C2PA_RS_PR: ${{ github.event.client_payload.pr_number }}
C2PA_RS_REF: ${{ github.event.client_payload.ref }}
C2PA_RS_SHA: ${{ github.event.client_payload.head_sha }}

jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout c2pa-python
uses: actions/checkout@v6

- name: Checkout c2pa-rs @ PR branch
uses: actions/checkout@v6
with:
repository: contentauth/c2pa-rs
ref: ${{ github.event.client_payload.ref }}
path: c2pa-rs

- name: Report start to c2pa-rs
env:
GH_TOKEN: ${{ secrets.CROSS_ORG_PR_TOKEN }}
run: |
gh api -X POST "repos/contentauth/c2pa-rs/statuses/$C2PA_RS_SHA" \
-f state=pending \
-f "context=breaking-changes / $REPO_NAME" \
-f "description=Building $REPO_NAME against c2pa-rs branch $C2PA_RS_REF..." >/dev/null

- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: "3.12"

# Follows c2pa-python's documented "Building from local c2pa-rs sources"
# flow (README). The make targets honor the active virtualenv.
- name: Build against local c2pa-rs and test
id: build
continue-on-error: true
env:
C2PA_RS_PATH: ${{ github.workspace }}/c2pa-rs
run: |
make create-venv
. .venv/bin/activate
make install-deps
make build-from-source C2PA_RS_PATH="$C2PA_RS_PATH"
make test

- name: Report result to c2pa-rs
if: always()
env:
GH_TOKEN: ${{ secrets.CROSS_ORG_PR_TOKEN }}
run: |
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [ "${{ steps.build.outcome }}" = "success" ]; then
state=success
desc="$REPO_NAME builds against the c2pa-rs branch."
else
state=failure
desc="$REPO_NAME does NOT build against the c2pa-rs branch — changes needed."
fi
gh api -X POST "repos/contentauth/c2pa-rs/statuses/$C2PA_RS_SHA" \
-f "state=$state" \
-f "context=breaking-changes / $REPO_NAME" \
-f "description=$desc" \
-f "target_url=$run_url" >/dev/null
Loading