Skip to content

Refresh the CFFI surface from MobilityDB master #10

Refresh the CFFI surface from MobilityDB master

Refresh the CFFI surface from MobilityDB master #10

#
# Keeps the committed CFFI surface (pymeos_cffi/functions.py and
# pymeos_cffi/__init__.py) tracking the MEOS line this package pins.
#
# PyMEOS-CFFI's package __version__ (X.Y) maps to the MobilityDB stable-X.Y branch
# when that branch exists, and to master otherwise — the same rule pr_build.yml and
# tools/refresh.conf follow. So the committed surface must always equal a fresh
# derivation from that line. build_header.py projects the cdef header from the
# catalog, keeping what the installed libmeos defines (it runs nm), so this
# provisions libmeos and regenerates from it rather than from a bare catalog.
#
# On a schedule (and on demand) this re-derives the surface and
# peter-evans/create-pull-request opens a PR only when it actually drifted (it
# no-ops on a clean tree). The normal build + ruff CI then gates the refresh PR
# like any other change.
#
name: Refresh the CFFI surface from MobilityDB master
on:
schedule:
# Daily.
- cron: '23 6 * * *'
workflow_dispatch:
concurrency:
group: meos-surface-refresh
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
jobs:
refresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Keep this ref in step with pymeos_cffi/__init__.py __version__ (1.4.0a1, with no
# stable-1.4 => master). The cdef covers every optional family.
- name: Provision libmeos + catalog at master
id: provision
uses: MobilityDB/MEOS-API/.github/actions/provision-meos@master
with:
mobilitydb-ref: master
build-libmeos: "true"
families: "-DALL=ON"
- name: Regenerate the CFFI surface from the provisioned MEOS
run: |
python3 -m pip install --upgrade pip ruff
PREFIX="${{ steps.provision.outputs.libmeos-prefix }}"
cp "${{ steps.provision.outputs.catalog-path }}" builder/meos-idl.json
python3 builder/build_header.py builder/meos-idl.json "$PREFIX/lib/libmeos.so" builder/meos.h
python3 builder/build_pymeos_functions.py
ruff format pymeos_cffi
# Opens a PR only if the surface drifted. PRs opened with the default
# GITHUB_TOKEN do NOT trigger workflow runs; supply a PAT in the
# MEOS_AUTOBUMP_TOKEN secret to get build + ruff CI on the refresh PR. Falls
# back to GITHUB_TOKEN (PR opens but must be re-triggered manually) when unset.
- name: Open a refresh PR if the surface drifted
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.MEOS_AUTOBUMP_TOKEN || secrets.GITHUB_TOKEN }}
branch: tooling/refresh-cffi-surface
base: master
add-paths: |
pymeos_cffi/functions.py
pymeos_cffi/__init__.py
commit-message: "Regenerate the CFFI surface from MobilityDB master"
title: "Regenerate the CFFI surface from MobilityDB master"
body: |
The committed CFFI surface drifted from a fresh derivation against the
MobilityDB master line this package pins; this regenerates it.
Opened by the `Refresh the CFFI surface from MobilityDB master` workflow.
delete-branch: true