diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba128c3..afefa15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -156,3 +156,23 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: gh release upload "$TAG" "$ASSET" "$ASSET.sha256" --clobber + + abi-manifest: + name: bddkit-plugin.json + needs: release + if: ${{ always() && (inputs.rebuild_tag != '' || needs.release.outputs.created == 'true') }} + runs-on: ubuntu-latest + permissions: + contents: write + env: + TAG: ${{ inputs.rebuild_tag != '' && inputs.rebuild_tag || needs.release.outputs.tag }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ env.TAG }} + + # Once per release, not from the per-target jobs, so they cannot race. + - name: Upload bddkit-plugin.json + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload "$TAG" bddkit-plugin.json --clobber diff --git a/bddkit-plugin.json b/bddkit-plugin.json new file mode 100644 index 0000000..972c2f6 --- /dev/null +++ b/bddkit-plugin.json @@ -0,0 +1 @@ +{"abi": 2} diff --git a/src/lib.rs b/src/lib.rs index 15bd7d6..696204c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -196,6 +196,17 @@ pub extern "C" fn bddkit_drop_instance(handle: u64) -> *mut c_char { #[cfg(test)] mod tests { + #[test] + fn bddkit_plugin_json_declares_the_abi_the_library_reports() { + let declared: serde_json::Value = + serde_json::from_str(include_str!("../bddkit-plugin.json")).expect("valid JSON"); + assert_eq!( + declared["abi"], + crate::bddkit_abi_version(), + "bddkit-plugin.json must name the ABI bddkit_abi_version() returns" + ); + } + #[test] fn the_manifest_claims_exec_per_worker_with_an_implicit_instance() { let v: serde_json::Value = serde_json::from_str(&crate::manifest_json()).expect("JSON");