-
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.
Add workflow for automatic rebase of dependencies repositories (#74)
- Loading branch information
Showing
6 changed files
with
263 additions
and
9 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,32 @@ | ||
#!/bin/bash | ||
|
||
source `dirname $0`/config.sh | ||
|
||
REBASE_BRANCH=$1 | ||
ORIGIN_BRANCH=$2 | ||
|
||
git fetch --all --prune | ||
|
||
# Check if $REBASE_BRANCH exists. | ||
if ! git show-ref --verify --quiet refs/remotes/origin/$REBASE_BRANCH; then | ||
echo "$REBASE_BRANCH does not exist!" | ||
exit 1 | ||
fi | ||
|
||
git switch $ORIGIN_BRANCH | ||
git reset --hard origin/$REBASE_BRANCH | ||
|
||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
TAG=$(date +%Y-%m-%d)-$(git log -n 1 --pretty=format:"%h" origin/$ORIGIN_BRANCH) | ||
|
||
# Create origin/$ORIGIN_BRANCH backup. | ||
git branch $ORIGIN_BRANCH-$TAG origin/$ORIGIN_BRANCH | ||
git push --set-upstream origin $ORIGIN_BRANCH-$TAG | ||
|
||
# Overwrite origin/$REBASE_BRANCH. | ||
git push --force-with-lease --set-upstream origin $ORIGIN_BRANCH | ||
git push origin -d $REBASE_BRANCH | ||
|
||
echo 'Success!' |
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,35 @@ | ||
#!/bin/bash | ||
|
||
source `dirname $0`/config.sh | ||
|
||
UPSTREAM_URL=$1 | ||
UPSTREAM_BRANCH=$2 | ||
REBASE_BRANCH=$3 | ||
|
||
# Add and update upstream remote. | ||
if ! git remote | grep upstream; then | ||
git remote add upstream $UPSTREAM_URL | ||
fi | ||
|
||
git fetch --all --prune | ||
|
||
# Checkout or create $REBASE_BRANCH. | ||
if git show-ref --verify --quiet refs/remotes/origin/$REBASE_BRANCH; then | ||
git switch $REBASE_BRANCH | ||
git pull origin $REBASE_BRANCH | ||
else | ||
git switch -c $REBASE_BRANCH | ||
fi | ||
|
||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
# Create upstream branch from upstream/$UPSTREAM_BRANCH. | ||
git branch upstream upstream/$UPSTREAM_BRANCH | ||
git push --set-upstream origin upstream | ||
|
||
# Rebase $REBASE_BRANCH on upstream/$UPSTREAM_BRANCH. | ||
git rebase upstream/$UPSTREAM_BRANCH | ||
git push --force-with-lease --set-upstream origin $REBASE_BRANCH | ||
|
||
echo 'Success!' |
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
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,179 @@ | ||
name: Daily rebase | ||
|
||
on: | ||
schedule: | ||
- cron: "0 5 * * *" | ||
workflow_dispatch: | ||
inputs: | ||
origin_branch: | ||
description: 'Origin branch' | ||
required: true | ||
default: 'woarm64' | ||
upstream_branch: | ||
description: 'Upstream branch' | ||
required: true | ||
default: 'master' | ||
rebase_branch: | ||
description: 'Rebase branch' | ||
required: true | ||
default: 'rebase-upstream' | ||
|
||
permissions: | ||
repository-projects: write | ||
|
||
env: | ||
BINUTILS_REPO: Windows-on-ARM-Experiments/binutils-woarm64 | ||
BINUTILS_UPSTREAM_URL: git://sourceware.org/git/binutils-gdb.git | ||
GCC_REPO: Windows-on-ARM-Experiments/gcc-woarm64 | ||
GCC_UPSTREAM_URL: git://gcc.gnu.org/git/gcc.git | ||
MINGW_REPO: Windows-on-ARM-Experiments/mingw-woarm64 | ||
MINGW_UPSTREAM_URL: https://git.code.sf.net/p/mingw-w64/mingw-w64 | ||
|
||
SOURCE_PATH: ${{ github.workspace }}/code | ||
ORIGIN_BRANCH: ${{ inputs.origin_branch || 'woarm64' }} | ||
UPSTREAM_BRANCH: ${{ inputs.upstream_branch || 'master' }} | ||
REBASE_BRANCH: ${{ inputs.rebase_branch || 'rebase-upstream' }} | ||
|
||
jobs: | ||
start-binutils-rebase: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout binutils | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.BINUTILS_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/binutils | ||
|
||
- name: Start binutils rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/binutils | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-start.sh ${{ env.BINUTILS_UPSTREAM_URL }} ${{ env.UPSTREAM_BRANCH }} ${{ env.REBASE_BRANCH }} | ||
start-gcc-rebase: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout GCC | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.GCC_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/gcc | ||
|
||
- name: Start GCC rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/gcc | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-start.sh ${{ env.GCC_UPSTREAM_URL }} ${{ env.UPSTREAM_BRANCH }} ${{ env.REBASE_BRANCH }} | ||
start-mingw-rebase: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout MinGW | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.MINGW_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/mingw | ||
|
||
- name: Start MinGW rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/mingw | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-start.sh ${{ env.MINGW_UPSTREAM_URL }} ${{ env.UPSTREAM_BRANCH }} ${{ env.REBASE_BRANCH }} | ||
build: | ||
needs: [start-binutils-rebase, start-gcc-rebase, start-mingw-rebase] | ||
uses: ./.github/workflows/advanced.yml | ||
with: | ||
binutils_branch: ${{ inputs.rebase_branch || 'rebase-upstream' }} | ||
gcc_branch: ${{ inputs.rebase_branch || 'rebase-upstream' }} | ||
mingw_branch: ${{ inputs.rebase_branch || 'rebase-upstream' }} | ||
|
||
finish-binutils-rebase: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout binutils | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.BINUTILS_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/binutils | ||
|
||
- name: Finish binutils rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/binutils | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-finish.sh ${{ env.REBASE_BRANCH }} ${{ env.ORIGIN_BRANCH }} | ||
finish-gcc-rebase: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout GCC | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.GCC_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/gcc | ||
|
||
- name: Finish GCC rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/gcc | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-finish.sh ${{ env.REBASE_BRANCH }} ${{ env.ORIGIN_BRANCH }} | ||
finish-mingw-rebase: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }} | ||
|
||
- name: Checkout MinGW | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GNU_PUSH_PAT }} | ||
repository: ${{ env.MINGW_REPO }} | ||
ref: ${{ env.ORIGIN_BRANCH }} | ||
path: ${{ env.SOURCE_PATH }}/mingw | ||
|
||
- name: Finish MinGW rebase | ||
working-directory: ${{ env.SOURCE_PATH }}/mingw | ||
run: | | ||
${{ github.workspace }}/.github/scripts/rebase-finish.sh ${{ env.REBASE_BRANCH }} ${{ env.ORIGIN_BRANCH }} |