Skip to content

Fix native publish artifacts - #122

Merged
nakasyou merged 1 commit into
mainfrom
fix/publish-native-packages-117-120
Apr 28, 2026
Merged

Fix native publish artifacts#122
nakasyou merged 1 commit into
mainfrom
fix/publish-native-packages-117-120

Conversation

@bot-rucachan

Copy link
Copy Markdown
Collaborator

Summary

  • fix native host artifact workflow filtering so job-level conditions do not reference matrix before expansion
  • hydrate optimizer native npm packages from downloaded artifacts/generated assets and fail publish when declared package files are missing
  • allow GTK4 workspace cargo fallback wherever the workspace host manifest exists, matching the existing dev-host tests

Fixes #117
Fixes #120

Verification

  • bunx vp fmt
  • bunx vp lint
  • bunx vp run typecheck
  • bunx vitest run packages/native/distribution.test.ts packages/optimizer/mod.test.ts
  • bun run --cwd packages/native-gtk4 test
  • bun run test

@github-actions

github-actions Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Website preview: https://pr-122-eclipsa.xiarenda61.workers.dev

Commit: cfc459c

@nakasyou
nakasyou requested a review from Copilot April 28, 2026 03:26
@codecov-commenter

codecov-commenter commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the publishing/packaging pipeline to ensure native artifacts are correctly included in published packages and that GitHub Actions workflow conditions don’t reference matrix values before expansion.

Changes:

  • Added an optimizer artifact “hydration” script that copies declared package files from downloaded/generated artifacts into per-target npm package directories and fails when files are missing.
  • Updated the optimizer artifacts script and tests to validate workflow ordering and hydration behavior.
  • Adjusted the publish workflow job/step conditions to avoid job-level matrix references; expanded GTK4 workspace cargo fallback behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/optimizer/scripts/hydrate-npm-artifacts.ts New script to populate per-target npm package dirs from artifacts/generated outputs and error on missing files.
packages/optimizer/package.json Switches artifacts script to run hydration instead of invoking the NAPI runner.
packages/optimizer/mod.test.ts Adds coverage for hydration behavior and validates workflow step ordering.
packages/native/distribution.test.ts Adds a regression test ensuring job-level workflow conditions don’t reference matrix.
packages/native-gtk4/vite.ts Expands workspace cargo fallback selection logic for GTK4 host command resolution.
.github/workflows/publish.yml Removes job-level matrix usage in conditions; moves filtering to step-level guards.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +26
const fileExists = async (filePath: string) => {
try {
await readFile(filePath)
return true
} catch {
return false
}
}

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileExists currently uses readFile() to check existence, which reads the entire artifact into memory (and will be invoked for native .node/.wasm binaries). This is unnecessarily expensive and differs from the existing pattern in prepare-downloaded-artifacts.ts which uses fs.promises.access(). Prefer access() (or stat()) here so existence checks don’t read large files and don’t allocate buffers.

Copilot uses AI. Check for mistakes.
Comment on lines 289 to 293
build_native_host_artifacts:
if: ${{ (inputs.package == 'native-swiftui' || inputs.package == 'native-android-compose' || inputs.package == 'native-gtk4') && matrix.settings.package == inputs.package }}
if: ${{ inputs.package == 'native-swiftui' || inputs.package == 'native-android-compose' || inputs.package == 'native-gtk4' }}
needs: prepare
runs-on: ${{ matrix.settings.host }}
strategy:

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the job-level if no longer filtering by matrix.settings.package, this job will still allocate runners for all matrix entries (including the two macOS runners) even when publishing a different package, and then skip most steps via step-level if. This can significantly increase CI cost/time. Consider restructuring to avoid spawning non-selected matrix jobs (e.g., split into separate per-package jobs, or make strategy.matrix depend on inputs.package via fromJson(...) so only the matching entries are included).

Copilot uses AI. Check for mistakes.
Fix native publish workflow matrix filtering and hydrate optimizer native package artifacts from downloaded build outputs before publishing.

Co-authored-by: codex <codex@openai.com>
@nakasyou
nakasyou force-pushed the fix/publish-native-packages-117-120 branch from 49a1a3e to cfc459c Compare April 28, 2026 03:49
@nakasyou
nakasyou merged commit 05e864f into main Apr 28, 2026
5 checks passed
@nakasyou
nakasyou deleted the fix/publish-native-packages-117-120 branch April 28, 2026 05:49
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.

fix publishing workflow @eclipsa/optimizer-linux-x64-gnu以外のネイティブパッケージにバイナリが含まれていない

4 participants