Skip to content

Subtree update automation: update submodules #394

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

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/update-subtree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
if: ${{ env.SUBTREE_PR_EXISTS == 'no' }}
run: |
cd splitsh-lite
sudo apt-get update
sudo apt-get install -y golang libgit2-dev
# git2go upstream hasn't been updated to more recent versions of
# libgit2, so using a fork that does stay up to date
Expand All @@ -110,6 +111,10 @@ jobs:
fi

git checkout ${NEXT_COMMIT_HASH}
# Collect submodule commits; note that submodules (intentionally!)
# aren't initialized, hence lines will be prefixed with "-" (see git
# submodule --help).
git submodule status -- library/ | sed 's/^-//' > ../submodule-heads
/usr/bin/time -v ../splitsh-lite/splitsh-lite --progress --prefix=library --target subtree/library
git checkout -b subtree/library subtree/library

Expand Down Expand Up @@ -165,6 +170,7 @@ jobs:
fi
fi
git checkout main
git submodule foreach 'git fetch'

# Tell git about the correct merge base to use, which is the subtree
# head that we last merged from.
Expand All @@ -178,6 +184,8 @@ jobs:
-c user.name=gitbot -c user.email=git@bot \
merge -Xsubtree=library subtree/library; then
echo "MERGE_CONFLICTS=yes" >> $GITHUB_ENV
# Ignore submodule conflicts, those are dealt with below.
for d in $(cat ../submodule-heads | cut -f2 -d" ") ; do git reset HEAD $d ; done
git -c user.name=gitbot -c user.email=git@bot commit -a -m "Merge from $NEXT_COMMIT_HASH with conflicts"
else
echo "MERGE_CONFLICTS=no" >> $GITHUB_ENV
Expand All @@ -187,6 +195,12 @@ jobs:
NEW_SUBTREE_HEAD=$(git rev-parse subtree/library)
echo "NEW_SUBTREE_HEAD=${NEW_SUBTREE_HEAD}" >> $GITHUB_ENV

# Set submodules to upstream versions
git submodule update --init
git submodule foreach 'grep $sm_path $toplevel/../submodule-heads | cut -f1 -d" " | xargs git checkout'
git -c user.name=gitbot -c user.email=git@bot \
commit -m "Update submodules" library/

sed -i "s/^channel = \"nightly-.*\"/channel = \"nightly-${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
git -c user.name=gitbot -c user.email=git@bot \
commit -m "Update toolchain to ${NEXT_TOOLCHAIN_DATE}" rust-toolchain.toml
Expand Down
Loading