|
| 1 | +# Receiver for c2pa-cpp. Install as |
| 2 | +# .github/workflows/test-c2pa-rs-branch.yml in contentauth/c2pa-cpp. |
| 3 | +# |
| 4 | +# c2pa-cpp normally downloads prebuilt native libs from c2pa-rs releases via |
| 5 | +# CMake FetchContent, but its CMakeLists supports a build-from-source path: |
| 6 | +# setting C2PA_BUILD_FROM_SOURCE=ON and C2PA_RS_PATH=<c2pa-rs checkout> builds |
| 7 | +# c2pa_c_ffi locally with cargo. So we re-target by checking out c2pa-rs at the |
| 8 | +# PR branch and building against it. There is no committable diff, so this |
| 9 | +# receiver is STATUS-ONLY (no draft PR); the status links to this workflow run. |
| 10 | +# |
| 11 | +# Requires the CROSS_ORG_PR_TOKEN secret (see contentauth/c2pa-rs |
| 12 | +# docs/breaking-change-automation/README.md). |
| 13 | + |
| 14 | +name: Test against c2pa-rs branch |
| 15 | + |
| 16 | +on: |
| 17 | + repository_dispatch: |
| 18 | + types: [c2pa-rs-breaking-change] |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +env: |
| 24 | + REPO_NAME: c2pa-cpp |
| 25 | + C2PA_RS_PR: ${{ github.event.client_payload.pr_number }} |
| 26 | + C2PA_RS_REF: ${{ github.event.client_payload.ref }} |
| 27 | + C2PA_RS_SHA: ${{ github.event.client_payload.head_sha }} |
| 28 | + |
| 29 | +jobs: |
| 30 | + verify: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Checkout c2pa-cpp |
| 34 | + uses: actions/checkout@v6 |
| 35 | + |
| 36 | + - name: Checkout c2pa-rs @ PR branch |
| 37 | + uses: actions/checkout@v6 |
| 38 | + with: |
| 39 | + repository: contentauth/c2pa-rs |
| 40 | + ref: ${{ github.event.client_payload.ref }} |
| 41 | + path: c2pa-rs |
| 42 | + |
| 43 | + - name: Report start to c2pa-rs |
| 44 | + env: |
| 45 | + GH_TOKEN: ${{ secrets.CROSS_ORG_PR_TOKEN }} |
| 46 | + run: | |
| 47 | + gh api -X POST "repos/contentauth/c2pa-rs/statuses/$C2PA_RS_SHA" \ |
| 48 | + -f state=pending \ |
| 49 | + -f "context=breaking-changes / $REPO_NAME" \ |
| 50 | + -f "description=Building $REPO_NAME against c2pa-rs branch $C2PA_RS_REF..." >/dev/null |
| 51 | +
|
| 52 | + - uses: dtolnay/rust-toolchain@stable |
| 53 | + |
| 54 | + - name: Install build tools |
| 55 | + run: sudo apt-get update && sudo apt-get install -y ninja-build cmake |
| 56 | + |
| 57 | + - name: Build against local c2pa-rs and test |
| 58 | + id: build |
| 59 | + continue-on-error: true |
| 60 | + env: |
| 61 | + C2PA_BUILD_FROM_SOURCE: "ON" |
| 62 | + C2PA_RS_PATH: ${{ github.workspace }}/c2pa-rs |
| 63 | + run: make test |
| 64 | + |
| 65 | + - name: Report result to c2pa-rs |
| 66 | + if: always() |
| 67 | + env: |
| 68 | + GH_TOKEN: ${{ secrets.CROSS_ORG_PR_TOKEN }} |
| 69 | + run: | |
| 70 | + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 71 | + if [ "${{ steps.build.outcome }}" = "success" ]; then |
| 72 | + state=success |
| 73 | + desc="$REPO_NAME builds against the c2pa-rs branch." |
| 74 | + else |
| 75 | + state=failure |
| 76 | + desc="$REPO_NAME does NOT build against the c2pa-rs branch — changes needed." |
| 77 | + fi |
| 78 | + gh api -X POST "repos/contentauth/c2pa-rs/statuses/$C2PA_RS_SHA" \ |
| 79 | + -f "state=$state" \ |
| 80 | + -f "context=breaking-changes / $REPO_NAME" \ |
| 81 | + -f "description=$desc" \ |
| 82 | + -f "target_url=$run_url" >/dev/null |
0 commit comments