fix(ci): build native plugin fixtures for the host target
The macOS job failed with no_matching_artifact because the integration test copied the Linux-only example manifest and built a Linux-named .so. Tests now generate a manifest for the actual host triple, use the platform dynamic library name and compiler flags, and never rewrite the tracked example manifest. - add a cross-platform no_matching_artifact test that runs without a C compiler - add real tamper and ABI-major-mismatch rejection tests - make worker fixtures platform-native; Windows remains explicitly unsupported (no cc) rather than counted as a pass - example build scripts emit host-specific build/ fixtures (gitignored) - CI smoke points at the generated fixtures
This commit is contained in:
1 parent
c7f3a8422c
commit
53cdea2325
7 files changed
+285
-85
No files matched your search
@@ -1,17 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the multi-export example and generate a host-specific manifest under
|
||||
# `build/` (gitignored). The tracked manifest is never rewritten.
|
||||
set -euo pipefail
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
repo="$(cd "$here/../.." && pwd)"
|
||||
cd "$repo"
|
||||
cc -std=c11 -O2 -shared -fPIC -I include -DMQ_SOLVER_MULTI_EXPORT \
|
||||
-o "$here/solver.so" examples/plugin-demo/solver.c
|
||||
hash="$(sha256sum "$here/solver.so" | cut -d' ' -f1)"
|
||||
python3 - "$here/plugin.yaml" "$hash" <<'PY'
|
||||
import pathlib, re, sys
|
||||
path, digest = sys.argv[1], sys.argv[2]
|
||||
p = pathlib.Path(path)
|
||||
text = p.read_text()
|
||||
text = re.sub(r'(?m)^(\s*sha256:\s*")[0-9a-fA-F]{64}(")', r'\g<1>' + digest + r'\g<2>', text)
|
||||
p.write_text(text)
|
||||
PY
|
||||
echo "built $here/solver.so"
|
||||
|
||||
out="$here/build"
|
||||
mkdir -p "$out"
|
||||
host="$(rustc -vV | sed -n 's/^host: //p')"
|
||||
case "$host" in
|
||||
*apple-darwin*) ext="dylib"; flags=(-dynamiclib -fPIC) ;;
|
||||
*windows*) ext="dll"; flags=(-shared) ;;
|
||||
*) ext="so"; flags=(-shared -fPIC) ;;
|
||||
esac
|
||||
artifact="solver.$ext"
|
||||
cc -std=c11 -O2 "${flags[@]}" -I include -DMQ_SOLVER_MULTI_EXPORT \
|
||||
-o "$out/$artifact" "$repo/examples/plugin-demo/solver.c"
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
hash="$(sha256sum "$out/$artifact" | cut -d' ' -f1)"
|
||||
else
|
||||
hash="$(shasum -a 256 "$out/$artifact" | cut -d' ' -f1)"
|
||||
fi
|
||||
cat > "$out/plugin.yaml" <<YAML
|
||||
plugin:
|
||||
name: demo.solver
|
||||
version: 0.1.0
|
||||
abi: "^1.0"
|
||||
kind: native
|
||||
exports:
|
||||
- name: solver.add
|
||||
signature: "(\$a: Int, \$b: Int) -> Int"
|
||||
- name: solver.neg
|
||||
signature: "(\$a: Int) -> Int"
|
||||
requires:
|
||||
- math.compute
|
||||
artifacts:
|
||||
- target: $host
|
||||
file: $artifact
|
||||
sha256: "$hash"
|
||||
YAML
|
||||
echo "built $out/$artifact for $host (sha256 $hash)"
|
||||
echo "now run: marqdo plugin inspect $out"
|
||||
Reference in new issue
Block a user