sidpug-arcana opened a new pull request, #207:
URL: https://github.com/apache/arrow-swift/pull/207
## What's Changed
Adds a workflow that regenerates the committed FlatBuffers Swift sources
when Dependabot bumps the FlatBuffers runtime, so those pull requests can pass
CI without a manual regeneration step.
**Stacked on #201** — this branch contains #201's commits; only the last two
are specific to this change.
### Details
- **`.github/workflows/regenerate-flatbuffers.yaml`** (new): runs on
Dependabot pull requests that change the FlatBuffers version.
- Downloads the `flatc` Linux binary for that exact version from the
`google/flatbuffers` release (the asset name suffix varies by version, so it is
discovered through `gh` rather than hardcoded).
- Fetches `format/*.fbs` from `apache/arrow` at the revision recorded in
`gen-flatbuffers.sh`.
- Runs `gen-flatbuffers.sh` and pushes the result back to the pull request
branch.
- Commits pushed with `GITHUB_TOKEN` don't trigger other workflows, so it
also runs the regular `docker compose` build and test before pushing; the run
itself is the verification.
- Uses only shell, `gh` and `docker compose`, plus the pinned
`actions/checkout`; no third-party actions. It sets `permissions: contents:
write`, which is enough to elevate the token on Dependabot-triggered
`pull_request` runs.
- **`gen-flatbuffers.sh`**:
- Fixes the relative `ARROW_FORMAT_DIR` path: the script `pushd`'d into
`Sources/Arrow/` first, so the default `../arrow/format` (and any relative
value) resolved against the wrong directory.
- Records `ARROW_REVISION`, the `apache/arrow` revision the committed
sources were generated from, as the single source of truth for the workflow.
- Requires the `flatc` on `PATH` to match the FlatBuffers runtime in
`Package.swift`, since a mismatch silently produces sources that don't compile
against the runtime.
### Notes
- If a runtime bump changes the API, hand-written code still needs manual
updates. The build/tests fail in that case and nothing is pushed, so the
workflow fails loudly rather than committing broken code.
- Dependabot may rebase its branch and drop the bot commit; in that case the
workflow runs again and re-adds it.
- The protocol buffer/gRPC sources are not covered yet, as suggested in the
issue.
## Testing
Verified locally (macOS, flatc 25.12.19):
- Regenerating from `apache/arrow@7151dcd6faa6` with a **relative**
`ARROW_FORMAT_DIR` now succeeds and reproduces all five
`Sources/Arrow/*_generated.swift` files **byte-for-byte**. Regenerating from
`apache/arrow` `main` instead produces doc-comment drift, which is why the
revision is pinned.
- The `flatc` version guard exits non-zero with a clear message when
`Package.swift` asks for a different version.
- `actionlint` reports no issues for the new workflow.
The workflow itself can't be exercised by this PR — it only runs for
Dependabot pull requests against `apache/arrow-swift` — so its first real run
will be the next FlatBuffers bump.
Closes #204.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]