Commit Graph

37 Commits

Author SHA1 Message Date
Rick Hanlon
bf1bb2e5e5 Fix xplat sync syntax error 2024-06-10 13:30:30 -04:00
Ricky
f81d5ee219 Fix xplat sync (#29833)
## Overview

The clever trick in https://github.com/facebook/react/pull/29799 turns
out to not work because signedsource includes the generated hash in the
header. Reverts back to checking git diff, filtering out the REVISION
file and `@generated` headers.
2024-06-10 13:24:45 -04:00
Rick Hanlon
a0e99f7a6d Revert bad push 2024-06-10 10:51:07 -04:00
Rick Hanlon
13cd4018a8 don't commit 2024-06-10 10:47:18 -04:00
Rick Hanlon
b6b2ab1e0c try this 2024-06-10 10:46:11 -04:00
Ricky
6b35ff766a Move @generated from build to sync (#29799)
## Overview

Reverts https://github.com/facebook/react/pull/26616 and implements the
suggested way instead.

This change in #26616 broken the internal sync command, which now
results in duplicated `@generated` headers. It also makes it harder to
detect changes during the diff train sync. Instead, we will check for
changes, and if there are changes sign the files and commit them to the
sync branch.

## Strategy

The new sync strategy accounts for the generated headers during the
sync:
- **Revert Version**: Revert the version strings
- **Revert @generated**: Re-sign the files (will be the same hash as
before if unchanged)
- **Check**: Check if there are changes **if not, skip**
- **Re-apply Version**: Now add back the new version string
- **Re-sign @generated**: And re-generate the headers

Then commit to branch. This ensures that if there are no changes, we'll
skip.

---------

Co-authored-by: Timothy Yung <yungsters@gmail.com>
2024-06-10 10:16:40 -04:00
Ricky
8c3697a849 Fix xplat sync to ignore @generated header (#29738)
Use some clever git diffing to ignore lines that only change the
`@generated` header. We can't do this for the version string because the
version string can be embedded in lines with other changes, but this
header is always on one line.
2024-06-03 16:39:38 -04:00
Rick Hanlon
b421783110 Don't skip www commit 2024-06-03 10:21:28 -04:00
Ricky
5ad2c37273 Skip empty sync commits (both repos) (#29707)
Requires https://github.com/facebook/react/pull/29706

The strategy here is to:
- Checkout the builds/facebook-www branch
- Read the current sync'd VERSION
- Checkout out main and sync new build
- sed/{new version string}/{old version string}
- Run git status, skip sync if clean
- Otherwise, sed/{old version string}/{new version string} and push
commit

This means that:
- We're using the real version strings from the builds
- We are checking the last commit on the branch for the real last
version
- We're skipping any commits that won't result in changes
- ???
- Profit!
2024-06-03 10:09:23 -04:00
Timothy Yung
5bd4031226 Revert Build Versions from Content Hash to Commit Hash (#29663)
https://github.com/facebook/react/pull/29236 caused issues for internal
syncs at Meta, because we were computing version numbers using file
hashes (to eliminate "no-op" internal sync commits). The problem is that
since version numbers may not be consistent across synced files (e.g. if
some files have not changed in recent commits), the newly introduced
version mismatch check fails.

There's some more work that needs to be done here to restore the
benefits of file-specific hashing, but for now this simply reverts the
content hash changes from the following PRs:

- https://github.com/facebook/react/pull/28633
(95319ab5af)
- https://github.com/facebook/react/pull/28590
(37676aba76)
- https://github.com/facebook/react/pull/28582
(cb076b593c)
- https://github.com/facebook/react/pull/26734
(5dd90c5623)
- https://github.com/facebook/react/pull/26331
(3cad3a54ed)
2024-05-30 07:26:12 -07:00
Timothy Yung
46abd7b1de Update compiled-rn destination paths to vendor/react (#28989)
I'm changing the destination paths in fbsource from `vendor/*` to
`vendor/react/*`.
2024-05-03 15:46:43 -07:00
Jon Janzen
38cd73b25b Stop committing resources to an external repo (#28963)
This has been integrated into this repo (`builds/facebook-fbsource`) so
we no longer need the extra repo
2024-05-03 11:01:53 -07:00
Jon Janzen
1f0701c11e Write Diff Train import branch to this repo (#28869)
For fbsource we've historically used a separate repo for imports due to
internal limitations in Diff Train. Those have been lifted so we can now
commit this branch here and then we can import from this repo (and get
rid of the other repo)
2024-04-18 12:08:52 -07:00
Joseph Savona
64c8d2d45d Attempt to fix diff syncing for Meta (#28801)
#28796 broke Meta's PR syncing tool, hoping this fixes it
2024-04-09 14:05:18 -07:00
Masato Nakamura
51c9146072 Bump actions/checkout (#28383) 2024-02-20 22:46:43 +01:00
Jan Kassens
40f653d13c Remove WARNINGS file from FB (#27820)
The test was migrated to the generated JS file that allows Jest to track
the dependencies, we can now remove this file generation.
2023-12-08 16:21:15 -05:00
Jan Kassens
d3ed07bce0 [ci] try to fix commit_artifacts step (#27817)
Tries to fix the failure from
https://github.com/facebook/react/actions/runs/7142005723/job/19450371514

I think it failed because we cannot `mv` into a folder with existing
files or folders.
2023-12-08 12:38:35 -05:00
Jan Kassens
af1fc87b54 [meta] copy ReactAllWarnings.js file (#27811)
I recently added generation of this file in #27786, which builds the
file in CircleCI, but missed actually copying it to the facebook build
on GitHub Actions.

This adds the later.
2023-12-07 17:08:52 -05:00
Samuel Susla
5dd90c5623 Use content hash for react-native builds (#26734) 2023-05-02 12:04:02 +01:00
Jan Kassens
6d394e3d26 [actions] commit from special branches iff they exist (#26673)
This creates 2 special branches. If these special branches exist, we'll
commit build artifacts from these branches, main otherwise.
2023-04-19 12:11:40 -04:00
Samuel Susla
0018cf2246 Add REVISION file to react-fbsource-import (#26448)
For DiffTrain to fbsource, we need REVISION file in compiled-rn folder
2023-03-21 16:18:20 +00:00
Samuel Susla
c57b90f50d [DiffTrain] Add artifacts for React Native to compiled (#26204) 2023-03-20 11:23:55 +00:00
lauren
6854a3cf6d [difftrain] Fix broken workflow (#26421)
Seems like CircleCI now enforces passing a token when fetching
artifacts. I provisioned a new read-only CircleCI token just for
difftrain.

test plan: see https://github.com/facebook/react/actions/runs/4450679268
2023-03-17 12:16:55 -07:00
Ricky
21f6dba6a7 Sync from oss-experimental, not oss-stable (#26401)
## Overview

To test useEffectEvent, we need the experimental build of the lint
plugin.
2023-03-15 21:01:07 -04:00
Jan Kassens
3cad3a54ed Use content hash for facebook-www builds (#26331)
Currently, any commit to React causes an internal sync since the Git
commit hash is part of the build. This creates a lot more sync commits
and noise than necessary, see:
https://github.com/facebook/react/commits/builds/facebook-www

This PR changes the version string to be a hash of the target build
files instead. This way we get a new version with any change that
actually impacts the generated files and still have a matching version
across the files.
2023-03-06 17:13:17 -05:00
lauren
bfb9cbd8ca [difftrain] Make github sha clickable for easier debugging (#26225) 2023-02-23 07:59:22 -08:00
Samuel Susla
2cc54b57ed Change commit message for DiffTrain commigs (#26203)
Previously, the commit message looked something like this in Github: 
<img width="921" alt="Screenshot 2023-02-20 at 13 52 35"
src="https://user-images.githubusercontent.com/1733610/220126265-d77931e0-18ac-46a0-bf23-d868f8af17a9.png">

With this change, it will look like:

DiffTrain build for commit db5e6250d4.
2023-02-20 15:17:44 +00:00
lauren
21b49103d6 [difftrain] Remove dependency on node-fetch (#26182)
`fetch` is now provided by github-scripts implicitly in
https://github.com/actions/github-script/releases/tag/v6.4.0, so this
was causing a duplicate declaration error.
2023-02-16 12:47:12 -08:00
lauren
1c7055ddbb [DiffTrain] Add github url for the commit to the commit message (#25845)
Currently we just append the ref for the commit, let's make it clickable
for easier debugging in syncs.
2022-12-08 11:22:35 -08:00
lauren
c961f2f476 [DiffTrain] Add REVISION and REVISION_TRANSFORM to output (#25830)
We use these for the sync script, so to preserve option value let's
continue adding these files so the script can still be used for
arbitrary commits.
2022-12-06 09:55:37 -08:00
lauren
7c39922891 [DiffTrain] Strip @license from files (#25821)
We need to remove this for some internal tests. This was previously in
our upgrade script so adding it back here for parity.

Test plan: files were updated correctly
[[1]](1704bbb826 (diff-80b968e05ce2ceeff6e17c938dc722aff2c1c660f8ef402e6664bc5b2cafa5fbL2))
[[2]](1704bbb826 (diff-6ecd07a61c8e0e28793dace3f9f62751e4808de9c2965aa1ddeb0157f3c9b4ecL2))

Co-authored-by: Jan Kassens <jkassens@meta.com>
2022-12-06 09:01:24 -08:00
lauren
cd23e40c73 [DiffTrain] Use original commit message (#25809)
Instead of the current commit message (which just shows "Build for
<sha>", re-use the commit message from the origin commit instead.
2022-12-05 10:56:57 -08:00
lauren
030dae2f4c [DiffTrain] Fix null artifactsUrl and add more logging (#25768)
Log more info on the status of the process_artifacts_combined job to
help with debugging, and exit with exitcode 1 if anything goes wrong

Test plan: Ran the workflow
[successfully](https://github.com/facebook/react/actions/runs/3595185062)
2022-12-01 11:08:29 -08:00
lauren
799ee65343 [DiffTrain] Tweak folder structure (#25724)
Should hopefully be final tweaks! Sorry about all the noise.

Test plan: temporarily ran the workflow on this branch, verified output
in the builds/facebook-www branch is correct:
bfc0eb6cd4
2022-11-21 14:35:52 -08:00
lauren
62e2b1374b [DiffTrain] Fix incorrect build path (#25723) 2022-11-21 13:00:50 -08:00
lauren
e58b6c158b Reorganize build folders for DiffTrain (#25722)
Reorganize some files to make the DiffTrain config easier to setup. Also
add unstable_server-external-runtime to sync.
2022-11-21 12:42:49 -08:00
lauren
13681aaf9c Add github action to commit build artifacts for Facebook (#25721)
This PR adds a new GitHub action to commit build artifacts for Facebook
into a new protected branch. This will later be used to setup an
automatic sync to www.

The hacky spinloop is meant to be a temporary implementation until we
can support running a script internally on top of the synced diff
(coming soon). A GitHub token is otherwise required if we want to setup
a pub/sub between cirleci and github but it's not straightforward to
provision one for our org. So this workaround should do for now since we
won't keep it around for too long.

Example of it running and creating a commit on the `builds/facebook-www`
branch:
https://github.com/facebook/react/actions/runs/3516958576/jobs/5894251359
2022-11-21 11:03:23 -08:00