name: Packaging
on:
push:
branches: [main]
schedule:
- cron: "30 5 * * 1-5"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
symbol-exports:
name: Symbol Exports (Linux)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build SQLiteGIS cdylib (sqlite-extension feature)
run: cargo build -p sqlitegis --features sqlite-extension
- name: Locate shared library artifact
id: artifact
run: |
set -euo pipefail
target_root="${CARGO_TARGET_DIR:-target}"
build_dir="${target_root}/debug"
artifact=""
candidates=(
"${build_dir}/libsqlitegis.so"
"${build_dir}/deps/libsqlitegis.so"
)
for candidate in "${candidates[@]}"; do
if [[ -f "${candidate}" ]]; then
artifact="${candidate}"
break
fi
done
if [[ -z "${artifact}" ]]; then
found="$(find "${build_dir}" -maxdepth 3 -type f -name "libsqlitegis.so" | head -n 1 || true)"
if [[ -n "${found}" ]]; then
artifact="${found}"
fi
fi
if [[ -z "${artifact}" ]]; then
echo "::error::Could not locate libsqlitegis.so under ${build_dir}"
find "${build_dir}" -maxdepth 3 -type f -name "*sqlitegis*" -print || true
exit 1
fi
echo "artifact=${artifact}" >> "${GITHUB_OUTPUT}"
echo "Using artifact: ${artifact}"
- name: Verify exported SQLite entrypoint symbols
run: |
set -euo pipefail
if ! command -v nm >/dev/null 2>&1; then
echo "nm not available on runner; skipping symbol export check"
exit 0
fi
artifact="${{ steps.artifact.outputs.artifact }}"
symbols="$(nm -D "${artifact}")"
if ! grep -q "sqlite3_sqlitegis_init" <<< "${symbols}"; then
echo "::error::missing sqlite3_sqlitegis_init export in ${artifact}"
exit 1
fi
echo "sqlite3_sqlitegis_init is present in ${artifact}"
- name: Confirm symbol is NOT exported without sqlite-extension feature
run: |
set -euo pipefail
cargo clean -p sqlitegis --release || true
cargo build -p sqlitegis --release --no-default-features --features sqlite
artifact="target/release/libsqlitegis.so"
if [[ ! -f "${artifact}" ]]; then
echo "::error::expected ${artifact} but not found"
exit 1
fi
if nm -D "${artifact}" | grep -q "sqlite3_sqlitegis_init"; then
echo "::error::sqlite3_sqlitegis_init leaked into ${artifact} without sqlite-extension feature"
exit 1
fi
echo "Confirmed: no FFI entry point exported under --features sqlite (without sqlite-extension)"