forked from jax-ml/jax
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/rocm-main' into ci-upstream-sync…
…-55_1
- Loading branch information
Showing
4 changed files
with
103 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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,51 @@ | ||
# Pulls the latest changes from upstream into main and opens a PR to merge | ||
# them into rocm-main branch. | ||
|
||
name: ROCm Nightly Upstream Sync | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 6 * * 1-5' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
env: | ||
SYNC_BRANCH_NAME: ci-upstream-sync-${{ github.run_number }}_${{ github.run_attempt }} | ||
jobs: | ||
sync-main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
gh auth status | ||
gh repo sync rocm/jax -b main | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
create-sync-branch: | ||
needs: sync-main | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Create branch | ||
run: | | ||
git fetch | ||
git checkout origin/main | ||
git checkout -b $SYNC_BRANCH_NAME | ||
# Try and merge rocm-main into this new branch so that we don't run upstream's CI code | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git merge origin/rocm-main || true | ||
# If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts | ||
git merge --abort || true | ||
git push origin HEAD | ||
open-sync-pr: | ||
needs: create-sync-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
gh pr create --repo $GITHUB_REPOSITORY --head $SYNC_BRANCH_NAME --base rocm-main --title "CI: $(date +%x) upstream sync" --body "Daily sync with upstream" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains 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 @@ | ||
name: ROCm Open Upstream PR | ||
on: | ||
pull_request: | ||
types: [ labeled ] | ||
branches: [ rocm-main ] | ||
jobs: | ||
open-upstream: | ||
if: ${{ github.event.label.name == 'open-upstream' }} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
env: | ||
NEW_BRANCH_NAME: "${{ github.head_ref }}-upstream" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Rebase code to main | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Actions" | ||
git fetch | ||
git checkout -b $NEW_BRANCH_NAME origin/${{ github.head_ref }} | ||
git rebase --onto origin/main origin/rocm-main | ||
# Force push here so that we don't run into conflicts with the origin branch | ||
git push origin HEAD --force | ||
- name: Leave link to create PR | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
# Bash is not friendly with newline characters, so make our own | ||
NL=$'\n' | ||
# Encode the PR title and body for passing as URL get parameters | ||
TITLE_ENC=$(jq -rn --arg x "[ROCm] ${{ github.event.pull_request.title }}" '$x|@uri') | ||
BODY_ENC=$(jq -rn --arg x $"${{ github.event.pull_request.body }}${NL}${NL}Created from: rocm/jax#${{ github.event.pull_request.number }}" '$x|@uri') | ||
# Create a link to the that will open up a new PR form to upstream and autofill the fields | ||
CREATE_PR_LINK="https://github.com/jax-ml/jax/compare/main...ROCm:jax:$NEW_BRANCH_NAME?expand=1&title=$TITLE_ENC&body=$BODY_ENC" | ||
# Add a comment with the link to the PR | ||
COMMENT_BODY="Feature branch from main is ready. [Create a new PR][1] destined for upstream?${NL}${NL}[1]: $CREATE_PR_LINK" | ||
gh pr comment ${{ github.event.pull_request.number }} --repo rocm/jax --body "$COMMENT_BODY" | ||
This file contains 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