Skip to content

CMake regeneration workflow #1774

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 14 commits into from
Feb 9, 2024
48 changes: 35 additions & 13 deletions .github/workflows/sync_cmakebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,43 @@ on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
inputs:
test_label_regexp:
required: false
type: string
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
jobs:
build:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: cmakebuild
- name: Sync
run: |
git checkout main -- ydb/ci/sync_cmakebuild.sh
cp ydb/ci/sync_cmakebuild.sh ~
git restore ydb/ci/sync_cmakebuild.sh
~/sync_cmakebuild.sh
git push
mainsha=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" https://api.github.com/repos/$REPO/commits/main)
echo "Main sha: ${mainsha}"
lastsha=$(curl -s https://raw.githubusercontent.com/$REPO/cmakebuild/ydb/ci/cmakegen.txt)
echo "Last sha: ${lastsha}"
if [ ${mainsha} == ${lastsha} ];then
echo "No new commits on the main branch to merge, exiting"
exit 0
fi
git clone -b main --shallow-exclude cmakebuild https://$TOKEN@github.com/$REPO.git ydb
git config --global user.email "alex@ydb.tech"
git config --global user.name "Alexander Smirnov"
cd ydb
git fetch --depth `expr $(git rev-list --count HEAD) + 1`
git fetch origin cmakebuild:cmakebuild --depth 3 # 1st with cmake generation, 2nd with previous merge, 3rd is common between main and cmakebuild
mainsha=$(git rev-parse HEAD)
git checkout cmakebuild
prevsha=$(git rev-parse HEAD)
git merge main --no-edit
currsha=$(git rev-parse HEAD)
if [ ${prevsha} == ${currsha} ];then
echo "Merge did not bring any changes, exiting"
exit
fi
./generate_cmake -k
echo ${mainsha} > ydb/ci/cmakegen.txt
git add .
git commit -m "Generate cmake for ${mainsha}"
git push --set-upstream origin cmakebuild