Skip to content

Commit

Permalink
Update bench-update-weights-weekly.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Dec 9, 2024
1 parent 1bc4f70 commit d1ace92
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions .github/workflows/bench-update-weights-weekly.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
name: Weekly update of benchmarks (frame-omni-bencher)

on:
pull_request:
schedule:
- cron: '0 1 * * 0' # weekly on Sunday night 01:00 UTC

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: # allow the action to create a PR
contents: write
issues: write
Expand All @@ -22,7 +17,6 @@ jobs:
runtime-matrix:
runs-on: ubuntu-latest
needs: [preflight]
if: ${{ needs.preflight.outputs.changes_rust }}
timeout-minutes: 30
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
Expand All @@ -34,7 +28,7 @@ jobs:
- id: runtime
run: |
# only first two runtimes
RUNTIMES=$(jq '[.[] | select(.package != null)]' .github/workflows/runtimes-matrix.json | jq '.[0:2]')
RUNTIMES=$(jq '[.[] | select(.package != null)]' .github/workflows/runtimes-matrix.json)
RUNTIMES=$(echo $RUNTIMES | jq -c .)
echo "runtime=$RUNTIMES"
Expand All @@ -43,7 +37,6 @@ jobs:
run-frame-omni-bencher:
runs-on: ${{ needs.preflight.outputs.RUNNER_WEIGHTS }}
needs: [preflight, runtime-matrix]
if: ${{ needs.preflight.outputs.changes_rust }}
timeout-minutes: 1440 # 24 hours per runtime
strategy:
fail-fast: false # keep running other workflows even if one fails, to see the logs of all possible failures
Expand All @@ -63,17 +56,14 @@ jobs:
fetch-depth: 0
ref: master


- name: script
id: required
run: |
cargo install subweight --locked
cargo install --path substrate/utils/frame/omni-bencher --locked
# Fixes "detected dubious ownership" error in the ci
git config --global --add safe.directory '*'
git remote -v
python3 -m pip install -r .github/scripts/generate-prdoc.requirements.txt
python3 .github/scripts/cmd/cmd.py bench --runtime ${{ matrix.runtime.name }} --pallet pallet_balances
python3 .github/scripts/cmd/cmd.py bench --runtime ${{ matrix.runtime.name }}
git add .
git status
Expand All @@ -100,6 +90,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master

- name: Download all artifacts
uses: actions/download-artifact@v4
Expand All @@ -113,6 +106,8 @@ jobs:
private-key: ${{ secrets.CMD_BOT_APP_KEY }}

- name: Apply diff from artifacts folder
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
run: |
# scan all patch files in the patches directory
for file in patches/diff-*/diff-*.patch; do
Expand All @@ -134,21 +129,4 @@ jobs:
git commit -m "Update all weights weekly for $DATE"
git push --set-upstream origin "$BRANCH"
git status
gh auth login --with-token ${{ steps.generate_token.outputs.token }}
gh pr create --title "Update weights weekly for $DATE" --body "Update weights weekly for $DATE"
confirm-frame-omni-benchers-passed:
runs-on: ubuntu-latest
name: All benchmarks passed
needs: [run-frame-omni-bencher]
if: always() && !cancelled()
steps:
- run: |
tee resultfile <<< '${{ toJSON(needs) }}'
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l)
if [ $FAILURES -gt 0 ]; then
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY
fi
gh pr create --title "Update weights weekly for $DATE" --body "Update weights weekly for $DATE"

0 comments on commit d1ace92

Please sign in to comment.