Skip to content

verify-action-build: support Dart-based actions (setup-dart)#741

Merged
potiuk merged 1 commit intomainfrom
verify-action-build-dart-support
Apr 19, 2026
Merged

verify-action-build: support Dart-based actions (setup-dart)#741
potiuk merged 1 commit intomainfrom
verify-action-build-dart-support

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 19, 2026

Summary

Teach verify-action-build to rebuild actions whose source is written in Dart (e.g. dart-lang/setup-dart).

When a pubspec.yaml exists at the repo root, the Dockerfile now:

  • Installs the Dart SDK from Google's apt repo.
  • Installs @vercel/ncc globally (setup-dart's dist script invokes bare ncc build rather than npx ncc, so it has to be on PATH).
  • Runs dart pub get so pubspec dependencies (path, pub_semver, …) are resolved before dart compile js.

Also adds all to the list of candidate npm scripts — setup-dart's all script chains build + dist as one step, and other actions use the same convention.

Why this was broken

Without these tools the Dockerfile's npm run build/package/start loop failed silently (2>/dev/null) and fell through to the npx ncc build --source-map fallback. That produced dist/index.mjs but omitted dist/main.cjs (the dart2js output) and dist/sig.txt (generated by dart tool/sig.dart), so every rebuild of a Dart action diffed against the published one.

Verification

Against PR #739 (allowing dart-lang/setup-dart@e51d8e571e22):

Before:

JS build verification   ✗   DIFFERENCES DETECTED

After:

JS build verification   ✓   compiled JS matches rebuild

Test plan

  • uv run utils/verify-action-build.py --from-pr 739 --ci passes against dart-lang/setup-dart@e51d8e571e22
  • Rerun against an existing JS-only action (e.g. one from the approved allowlist) to confirm behaviour is unchanged for non-Dart actions
  • CI green on this branch

Actions such as dart-lang/setup-dart compile their source from Dart to
JavaScript in the `build` npm script (`dart compile js ...`) and then
bundle via a bare `ncc build` invocation in `dist`. The node:slim base
image has neither the Dart SDK nor `@vercel/ncc`, so the build loop
silently fell through to the `npx ncc build --source-map` fallback,
producing an incomplete rebuild missing `main.cjs` and `sig.txt`.

When a `pubspec.yaml` is detected at the repo root, install the Dart
SDK from Google's apt repo, install `@vercel/ncc` globally, and run
`dart pub get` so the pubspec dependencies resolve before compilation.
Also add `all` to the list of candidate npm scripts so actions whose
`all` script chains build+package steps (the setup-dart convention)
run as a single step.

With these changes, `verify-action-build --from-pr 739` against
dart-lang/setup-dart@e51d8e571e22 reports "All compiled JavaScript
matches the rebuild".

Generated-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@potiuk potiuk mentioned this pull request Apr 19, 2026
7 tasks
@potiuk potiuk merged commit 0abd7db into main Apr 19, 2026
8 checks passed
@potiuk potiuk deleted the verify-action-build-dart-support branch April 19, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants