-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
123 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Sync | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
jobs: | ||
setup: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build Docker image | ||
run: | | ||
cd build | ||
docker build -t td . | ||
docker run --name td -it --detach --privileged --env GITHUB_API_TOKEN=${{ secrets.GH_TOKEN }} td /bin/bash | ||
docker exec td /bin/sh -c "git clone https://${{ secrets.GH_TOKEN }}@github.com/ponces/treble_aosp" | ||
sync: | ||
needs: setup | ||
runs-on: self-hosted | ||
steps: | ||
- name: Sync with TrebleDroid | ||
run: docker exec td /bin/sh -c "bash treble_aosp/sync.sh" | ||
|
||
cleanup: | ||
needs: sync | ||
runs-on: self-hosted | ||
if: ${{ always() }} | ||
steps: | ||
- name: Cleanup | ||
run: | | ||
docker stop td || true | ||
docker system prune -f |
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,78 @@ | ||
#!/bin/bash | ||
|
||
echo | ||
echo "--------------------------------------" | ||
echo " AOSP 14.0 Syncbot " | ||
echo " by " | ||
echo " ponces " | ||
echo "--------------------------------------" | ||
echo | ||
|
||
set -e | ||
|
||
BL=$PWD/treble_aosp | ||
TD="android-14.0" | ||
|
||
initRepos() { | ||
echo "--> Getting latest upstream version" | ||
aosp=$(curl -sL https://github.com/TrebleDroid/treble_manifest/raw/android-14.0/replace.xml | grep -oP "android-14.0.0_r\d+" | head -1) | ||
|
||
echo "--> Initializing workspace" | ||
repo init -u https://android.googlesource.com/platform/manifest -b "$aosp" | ||
echo | ||
|
||
echo "--> Preparing local manifest" | ||
if [ -d .repo/local_manifests ]; then | ||
(cd .repo/local_manifests; git fetch; git reset --hard; git checkout origin/$TD) | ||
else | ||
git clone https://github.com/TrebleDroid/treble_manifest .repo/local_manifests -b $TD | ||
fi | ||
echo | ||
} | ||
|
||
syncRepos() { | ||
echo "--> Syncing repos" | ||
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all) || repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all) | ||
echo | ||
} | ||
|
||
generatePatches() { | ||
echo "--> Generating patches" | ||
rm -rf patchestd patchestd.zip | ||
wget -q https://github.com/TrebleDroid/treble_experimentations/raw/master/list-patches.sh -O list-patches.sh | ||
sed -i "s/patches/patchestd/g" list-patches.sh | ||
bash list-patches.sh | ||
echo | ||
} | ||
|
||
updatePatches() { | ||
echo "--> Updating patches" | ||
rm -rf $BL/patches/trebledroid | ||
unzip -q patchestd.zip | ||
mv patchestd $BL/patches/trebledroid | ||
echo | ||
} | ||
|
||
commitPatches() { | ||
echo "--> Committing patches" | ||
pushd $BL &>/dev/null | ||
git add patches/trebledroid | ||
git commit -m "feat: sync with latest sources of TrebleDroid" | ||
git push | ||
popd &>/dev/null | ||
} | ||
|
||
START=$(date +%s) | ||
|
||
initRepos | ||
syncRepos | ||
generatePatches | ||
updatePatches | ||
commitPatches | ||
|
||
END=$(date +%s) | ||
ELAPSEDM=$(($(($END-$START))/60)) | ||
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60)) | ||
|
||
echo "--> Syncbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds" | ||
echo |