Repository navigation
Refresh generated surface from MobilityDB master #127
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Keeps the committed generated UDF surface (src/generated/) tracking | |
| # MobilityDB/MobilityDB master. | |
| # | |
| # MobilityDuck derives its catalog from master (via the shared provision-meos | |
| # action) and records the commit it derived from in the vcpkg MEOS port, so libmeos | |
| # and the generated surface always come from one upstream commit. The generated | |
| # surface cannot be produced inside the cmake/vcpkg build (deriving the catalog | |
| # needs the provision-meos action — libclang + a MobilityDB checkout — not runnable | |
| # in cmake), so it is committed and refreshed by this workflow rather than | |
| # regenerated live during the build. | |
| # | |
| # On a schedule (and on demand) this re-derives the catalog from master, regenerates | |
| # src/generated, and advances the port's recorded SHA to the same commit; | |
| # peter-evans/create-pull-request opens a PR only when something actually drifted | |
| # (it no-ops on a clean tree). One PR therefore carries the surface and the library | |
| # it links against, and the distribution pipeline gates it like any other change. | |
| # | |
| # vcpkg re-keys its binary cache on the port's content, which embeds the recorded | |
| # SHA, so advancing the SHA is enough to stop a stale cached libmeos being served. | |
| # | |
| name: Refresh generated surface from MobilityDB master | |
| on: | |
| schedule: | |
| # Daily; MobilityDB master rarely changes the derived surface more than once a day. | |
| - cron: '17 6 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: meos-surface-refresh | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| # Catalog only (build-libmeos: false): the generator is pure Python and | |
| # reads the catalog JSON, so no libmeos build is needed here. | |
| - name: Derive the MEOS catalog at master | |
| id: provision | |
| uses: MobilityDB/MEOS-API/.github/actions/provision-meos@master | |
| with: | |
| mobilitydb-ref: master | |
| build-libmeos: "false" | |
| - name: Stage the catalog and regenerate the UDF surface | |
| run: | | |
| mkdir -p tools/catalog | |
| cp "${{ steps.provision.outputs.catalog-path }}" tools/catalog/meos-idl.json | |
| python3 tools/codegen_duck_udfs.py \ | |
| tools/catalog/meos-idl.json \ | |
| src/generated/generated_temporal_udfs.cpp | |
| # Advance the port's recorded SHA to the very commit the catalog was derived | |
| # from, so libmeos and the regenerated surface move together in one PR. The | |
| # catalog stamps that commit itself, which is what makes the two atomic — | |
| # reading master's tip again here could pick up a newer commit than the one | |
| # the surface was generated against. | |
| - name: Advance the MEOS port to the derived commit | |
| run: | | |
| ref=$(python3 -c 'import json;print(json.load(open("tools/catalog/meos-idl.json"))["sourceCommit"])') | |
| case "$ref" in | |
| [0-9a-f]*) ;; | |
| *) echo "catalog carries no usable sourceCommit: '$ref'" >&2; exit 1 ;; | |
| esac | |
| python3 - "$ref" <<'PY' | |
| import re, sys | |
| path = "vcpkg_ports/meos/portfile.cmake" | |
| src = open(path).read() | |
| new, n = re.subn(r'(set\(_MEOS_REF ")[0-9a-f]+(")', r'\g<1>%s\g<2>' % sys.argv[1], src, count=1) | |
| if n != 1: | |
| sys.exit("portfile.cmake: expected exactly one _MEOS_REF assignment, found %d" % n) | |
| open(path, "w").write(new) | |
| PY | |
| git diff --stat vcpkg_ports/meos/portfile.cmake | |
| # Opens a PR only if src/generated drifted. The bump PR must run the full | |
| # distribution + generate CI. PRs opened with the default GITHUB_TOKEN do NOT | |
| # trigger workflow runs; supply a PAT in the MEOS_AUTOBUMP_TOKEN secret to get | |
| # CI on the refresh PR. Falls back to GITHUB_TOKEN (PR opens but must be | |
| # re-triggered manually) when unset. The catalog stays gitignored (derived). | |
| - name: Open a refresh PR if the surface drifted | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.MEOS_AUTOBUMP_TOKEN || secrets.GITHUB_TOKEN }} | |
| branch: tooling/refresh-generated-surface | |
| base: main | |
| # BOTH paths: the surface and the commit it is derived from advance together. | |
| # Staging only src/generated drops the _MEOS_REF rewrite, leaving a surface | |
| # generated from a newer master than the libmeos it links against. | |
| add-paths: | | |
| src/generated | |
| vcpkg_ports/meos/portfile.cmake | |
| commit-message: "Advance the MEOS commit and regenerate the UDF surface" | |
| title: "Advance the MEOS commit and regenerate the UDF surface" | |
| body: | | |
| The committed `src/generated/` drifted from a fresh derivation against | |
| MobilityDB/MobilityDB master; this regenerates it and moves | |
| `_MEOS_REF` in `vcpkg_ports/meos/portfile.cmake` to the commit it is | |
| derived from, so libmeos and the surface stay one commit. | |
| Opened by the `Refresh generated surface from MobilityDB master` workflow. | |
| delete-branch: true |