Skip to content
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

Update cmd.yml #6969

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
92 changes: 65 additions & 27 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,9 @@ jobs:
image: ${{ needs.set-image.outputs.IMAGE }}
timeout-minutes: 1440 # 24 hours per runtime
steps:
- name: Generate token
uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.CMD_BOT_APP_ID }}
private-key: ${{ secrets.CMD_BOT_APP_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ needs.get-pr-branch.outputs.repo }}
ref: ${{ needs.get-pr-branch.outputs.pr-branch }}

Expand Down Expand Up @@ -408,35 +400,81 @@ jobs:
app-id: ${{ secrets.CMD_BOT_APP_ID }}
private-key: ${{ secrets.CMD_BOT_APP_KEY }}

- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.generate_token_commit.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.generate_token_commit.outputs.token }}

- name: Commit changes
run: |
# Allow some time for token propagation
sleep 5

if [ -n "$(git status --porcelain)" ]; then
git config --global user.name command-bot
git config --global user.email "<>"
git config --global pull.rebase false
git config --global user.name '${{ steps.generate_token_commit.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.generate_token_commit.outputs.app-slug }}[bot]@users.noreply.github.com>'

# Push the results to the target branch
git remote add \
github \
"https://x-access-token:${{ steps.generate_token_commit.outputs.token }}@github.com/${{ needs.get-pr-branch.outputs.repo }}.git" || :

push_changes() {
git push github "HEAD:${{ needs.get-pr-branch.outputs.pr-branch }}"
}
git config --global pull.rebase false

TOKEN="${{ steps.generate_token_commit.outputs.token }}"
REPO="${{ needs.get-pr-branch.outputs.repo }}"
BRANCH="${{ needs.get-pr-branch.outputs.pr-branch }}"

# Remove existing remote if any
git remote remove github 2>/dev/null || true

# Add remote with explicit token
git remote add github "https://x-access-token:${TOKEN}@github.com/${REPO}.git"

# Stage changes
git add .
git restore --staged Cargo.lock # ignore changes in Cargo.lock
git commit -m "Update from ${{ github.actor }} running command '${{ steps.get-pr-comment.outputs.group2 }}'" || true

# Attempt to push changes
if ! push_changes; then
echo "Push failed, trying to rebase..."
git pull --rebase github "${{ needs.get-pr-branch.outputs.pr-branch }}"
# After successful rebase, try pushing again
push_changes
# Commit changes
git commit -m "Update from ${{ github.actor }} running command '${{ steps.get-pr-comment.outputs.group2 }}'" || {
echo "No changes to commit"
exit 0
}

# Function to push with retries
push_with_retries() {
max_attempts=3
attempt=1

while [ $attempt -le $max_attempts ]; do
echo "Push attempt $attempt of $max_attempts"

if git push github "HEAD:${BRANCH}"; then
echo "Push successful"
return 0
else
echo "Push failed on attempt $attempt"

if [ $attempt -lt $max_attempts ]; then
echo "Trying to rebase..."
if ! git pull --rebase github "${BRANCH}"; then
echo "Rebase failed, retrying from scratch"
git rebase --abort || true
fi
sleep 5
fi
fi

attempt=$((attempt + 1))
done

echo "Failed to push after $max_attempts attempts"
return 1
}

# Attempt the push with retries
if ! push_with_retries; then
echo "All push attempts failed"
exit 1
fi
else
echo "Nothing to commit";
echo "No changes to commit"
fi

- name: Run Subweight
Expand Down
52 changes: 26 additions & 26 deletions polkadot/runtime/westend/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-12-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-12-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `95c137a642c3`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `afe3a6255eeb`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -56,8 +56,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 51_474_000 picoseconds.
Weight::from_parts(52_840_000, 0)
// Minimum execution time: 50_798_000 picoseconds.
Weight::from_parts(52_292_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -68,8 +68,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 39_875_000 picoseconds.
Weight::from_parts(41_408_000, 0)
// Minimum execution time: 39_864_000 picoseconds.
Weight::from_parts(40_673_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -80,8 +80,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 19_614_000 picoseconds.
Weight::from_parts(20_194_000, 0)
// Minimum execution time: 20_190_000 picoseconds.
Weight::from_parts(20_804_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -92,8 +92,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 27_430_000 picoseconds.
Weight::from_parts(28_151_000, 0)
// Minimum execution time: 27_585_000 picoseconds.
Weight::from_parts(28_956_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -104,8 +104,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 54_131_000 picoseconds.
Weight::from_parts(54_810_000, 0)
// Minimum execution time: 52_882_000 picoseconds.
Weight::from_parts(54_319_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
Expand All @@ -116,8 +116,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 48_692_000 picoseconds.
Weight::from_parts(51_416_000, 0)
// Minimum execution time: 49_364_000 picoseconds.
Weight::from_parts(50_500_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -128,8 +128,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 22_604_000 picoseconds.
Weight::from_parts(23_336_000, 0)
// Minimum execution time: 22_715_000 picoseconds.
Weight::from_parts(23_359_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -141,11 +141,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 18_118_000 picoseconds.
Weight::from_parts(18_352_000, 0)
// Minimum execution time: 17_407_000 picoseconds.
Weight::from_parts(17_665_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 14_688
.saturating_add(Weight::from_parts(15_412_440, 0).saturating_mul(u.into()))
// Standard Error: 12_252
.saturating_add(Weight::from_parts(15_552_875, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
Expand All @@ -154,24 +154,24 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_779_000 picoseconds.
Weight::from_parts(7_246_000, 0)
// Minimum execution time: 6_660_000 picoseconds.
Weight::from_parts(7_017_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 30_935_000 picoseconds.
Weight::from_parts(32_251_000, 0)
// Minimum execution time: 31_435_000 picoseconds.
Weight::from_parts(31_884_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 21_002_000 picoseconds.
Weight::from_parts(21_760_000, 0)
// Minimum execution time: 20_832_000 picoseconds.
Weight::from_parts(21_648_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
Loading