Merge upstream/main, resolve Action-refactor conflicts - #8
Merged
Merged
Conversation
…r#185) ## What is this? The React Native Harness GitHub Action no longer ships bundled JavaScript. Its four Node steps — config loading and the three Metro cache planning steps — now run through the `react-native-harness` CLI already installed in the project under test, via a new `harness ci <subcommand>` command group. Previously those steps ran prebuilt `actions/shared/*.cjs` files committed to the repository. Because the bundler inlined `@react-native-harness/config`, `@react-native-harness/cache`, and `@react-native-harness/platform-android`, any change to those packages rewrote roughly 628KB of committed output across four near-identical bundles. Contributors had to remember to rebuild and commit them, and regularly did not. ## How does it work? `harness ci` exposes `load-config`, `plan-metro-restore`, `snapshot-metro`, and `plan-metro-save`, each a direct move of the corresponding action script with its environment-variable and `GITHUB_OUTPUT` contract unchanged. The composite action calls them through the detected package manager, the same way it already invokes the CLI to run tests, so the scripts now come from the same package version that will run the suite rather than from a snapshot pinned to the action ref. Two ordering changes support this. Package manager detection moves to the first step, since it is needed to invoke the CLI at all. A version guard follows it: on a CLI predating `harness ci`, the subcommand would fall through to the Jest CLI and be read as a test path pattern, so the action resolves the installed version up front and fails with an explicit message when it is missing or older than the release that introduces the command. Because those steps now run with `working-directory` set to the project root, path handling is anchored to `GITHUB_WORKSPACE` rather than the current directory. `INPUT_PROJECTROOT` and the emitted `projectRoot` stay relative to the checkout root, which is what `actions/cache`, `actions/upload-artifact`, and `hashFiles(...)` resolve against regardless of a step's working directory. The `@react-native-harness/github-action` package and the `actions/` directory are removed, and its README moves to `docs/github-action.md`. `packages/cli` gains a test target it previously lacked, so the moved cache tests and the package's two existing suites now run in CI. ## Why is this useful? No generated code remains in the repository, so the rebuild-and-commit step disappears along with the class of pull request that silently ships a stale bundle. Changes to config parsing or cache key computation take effect through the normal package graph, and reviewers see the actual diff instead of hundreds of kilobytes of bundler output. Consumers of the action get scripts that match their installed Harness version, with a clear failure when the two drift apart.
## What is this? Introduces a filesystem context for Harness and applies it to the GitHub Action so its filesystem-dependent behavior can be tested without host temporary directories. ## How does it work? `@react-native-harness/tools` now provides an AsyncLocalStorage-backed context, a real Node filesystem default, and a memfs-powered testing helper. The GitHub Action establishes that context at its entrypoints, uses `getFs()` in migrated code, and keeps runner logic separately callable under an in-memory filesystem. ## Why is this useful? Action tests become hermetic and faster to reason about, while the new port creates a consistent path for incrementally migrating the remaining Harness filesystem usage. Closes callstackincubator#165
Resolves conflicts from the GitHub Action refactor (callstackincubator#185, deleted the bundled actions/*.cjs and packages/github-action, moved the steps to a 'harness ci' CLI subcommand). The Windows-specific action.yml changes (windows exempt from the app-input check, pwd -W for HARNESS_PROJECT_ROOT) carry over; the github.action_path quoting fix is obsolete now that the action no longer runs bundled scripts.
`harness ci load-config` writes `projectRoot=` to GITHUB_OUTPUT from a raw `path.relative`, which is `apps\foo` on a Windows runner. The action feeds that into `actions/cache` globs, `hashFiles()`, and a bash `working-directory`, all of which want `/`. Normalize the separator. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
mainup to date withcallstackincubator/react-native-harnessand resolves the conflicts the upstream Action refactor created for the Windows support work (upstream PR callstackincubator#187).What upstream changed
refactor: run action steps through the harness CLI) deletedpackages/github-actionand every bundledactions/*.cjs, and rewroteaction.yml. The steps now callreact-native-harness ci load-config/ci plan-metro-restore/ci snapshot-metro/ci plan-metro-savethrough the project's own installed CLI. A new guard step rejects areact-native-harnessthat predates theharness ciinterface (checksharnessActionProtocolon itspackage.json).feat: introduce injectable filesystem context) added an AsyncLocalStorage filesystem context and a memfs test helper to@react-native-harness/tools; the CLIcicode uses it.How the conflicts were resolved
All conflicts were in the Action files.
packages/github-action/**andactions/**: took upstream's deletion.action.yml: took upstream's new CLI-based steps. The${{ github.action_path }}quoting fix from the original work is dropped, since there are no bundled scripts to invoke anymore. The three Windows-specific bits merged onto the new structure cleanly and are kept:windowsexempt from the "app input required" check, the Windows section comment, andpwd -WforHARNESS_PROJECT_ROOT.One new fix
packages/cli/src/ci/workspace-root.ts: the newharness ci load-configwritesprojectRoot=toGITHUB_OUTPUTstraight frompath.relative, so on a Windows runner it emittedapps\foo. The Action feeds that intoactions/cacheglobs,hashFiles(), and a bashworking-directory, which want/. Its own test (load-config.test.ts) fails on a Windows host. Normalized the separator. No behavior change on Linux/macOS.Verification
nx run-many -t typecheck build lintgreen for all 22 projects.nx run-many -t testgreen on both Linux and a Windows host.react-native-harness ci load-configon Windows against a real RNW project config (mrousavy/nitro's example);platformId: windowsresolves and theprojectRootoutput is correct.After this merges, upstream PR callstackincubator#187 stops conflicting.