forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 9
Document and automate the process to fetch from upstream #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
# Prequisites: | ||
# This script assumes git and github CLR (gh) are installed. | ||
|
||
# Cause the script to fail if any individual command fails | ||
set -e | ||
|
||
# Fetch from upstream | ||
git remote add upstream https://github.com/dotnet/runtime | ||
git fetch upstream | ||
joshpeterson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Create a new branch for a pull request to merge in upstream/main | ||
# using the current date in the branch name. | ||
git checkout unity-main | ||
branch_name=bot-upstream-main-merge-$(date '+%Y-%m-%d') | ||
joncham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
git checkout -b $branch_name | ||
git merge upstream/main -m "Merge with main from upstream" | ||
git push --set-upstream origin $branch_name | ||
|
||
# Login to Github | ||
set -u | ||
joshpeterson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "$GITHUB_TOKEN" > .githubtoken | ||
unset GITHUB_TOKEN | ||
gh auth login --hostname github.com --with-token < .githubtoken | ||
rm .githubtoken | ||
|
||
# Yamato has a local mirror of github.com for cloning. This configuration | ||
# causes problems for Github CLI, so set the remote manually here. | ||
git remote set-url origin $GIT_REPOSITORY_URL | ||
|
||
# Create a pull request back to unity-main | ||
gh pr create --fill | ||
|
||
# For some unknown reason we often see this error from Github CLI: | ||
# | ||
# pull request create failed: HTTP 502: Something went wrong while executing your query. | ||
# This may be the result of a timeout, or it could be a GitHub bug. | ||
# Please include `B96C:2166:B667D:BCDCF:61A53AF5` when reporting this issue. (https://api.github.com/graphql) | ||
# | ||
# Often the pull request was actually created though, so manually check for it if this happens. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Update from upstream | ||
agent: | ||
type: Unity::VM | ||
image: platform-foundation/linux-ubuntu18.04-il2cpp-bokken:latest | ||
flavor: b1.xlarge | ||
joshpeterson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
commands: | ||
- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg | ||
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
- sudo apt update | ||
- sudo apt install gh | ||
- git config --global user.email "joshuap@unity3d.com" | ||
joncham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- git config --global user.name "Josh Peterson" | ||
- .yamato/scripts/update_from_upstream.sh | ||
|
||
triggers: | ||
recurring: | ||
- branch: unity-main | ||
frequency: weekly |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# .NET Runtime - Unity Details | ||
|
||
This is Unity's fork of the .NET Runtime repository. | ||
|
||
The difference between this fork and the upstream repository should be as small as possible, with all of the differences specific to Unity. Our goal is to upstream as many changes made here as possible. | ||
|
||
## Pulling changes from upstream | ||
|
||
There is a job in Unity's internal CI which runs weekly to pull the latest code from the upstream [dotnet/runtime](https://github.com/dotnet/runtime) repository `main` branch and create a pull request to merge these changes to the [`unity-main`](https://github.com/Unity-Technologies/runtime/tree/unity-main) branch. | ||
joshpeterson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Pushing changes to upstream | ||
|
||
When a pull request is open against this fork, we should determine if the changes in that pull request should be pushed upstream (most should). Ideally, pull request should be organized so that all changes in a given pull request can be directly applied upstream. Any changes specific to the Unity fork should be done in a separate pull request. | ||
|
||
Assuming the branch with changes to upstream is named `great-new-feature` then a new branch of upstream [`main`](https://github.com/dotnet/runtime/tree/main) named `upstream-great-new-feature` should be created. Each commit from `great-new-feature` should be cherry-picked `upstream-great-new-feature`, and then a pull request should be opened from `upstream-great-new-feature` to [`main`](https://github.com/dotnet/runtime/tree/main) in the upstream repository. | ||
|
||
It is acceptable to _merge_ changes to this fork from `great-new-feature` before `upstream-great-new-feature` is merged, but we should at least _open_ an upstream pull request first. |
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.
Uh oh!
There was an error while loading. Please reload this page.