Skip to content

Commit

Permalink
Update Bencher's version (#3792)
Browse files Browse the repository at this point in the history
Closes #3738 

This PR updates the bencher's version to use the new `--branch` feature
of `bencher report list` to filter the reports and fix the branch name
to get the `branch slug` expected for Bencher to correctly search for
the branch as it replaces the special character `/` by `-` and drops `_`
at the beginning of the string.
  • Loading branch information
Robertorosmaninho authored Nov 7, 2023
1 parent 83a7a93 commit 37f2a27
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ jobs:
-e GITHUB_TOKEN=$GITHUB_TOKEN \
-e GITHUB_ACTIONS=true \
-e GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME \
-e GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e GITHUB_REF=$GITHUB_REF \
-e GITHUB_SHA=${GITHUB_SHA} \
--workdir /opt/workspace \
-v "${workspace}:/opt/workspace" \
-v "${GITHUB_EVENT_PATH}:${GITHUB_EVENT_PATH}" \
${BASE_OS}:${BASE_DISTRO}
- name: 'Setting up dependencies'
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ jobs:
-e GITHUB_TOKEN=$GITHUB_TOKEN \
-e GITHUB_ACTIONS=true \
-e GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME \
-e GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e GITHUB_REF=$GITHUB_REF \
--workdir /opt/workspace \
-v "${workspace}:/opt/workspace" \
-v "${GITHUB_EVENT_PATH}:${GITHUB_EVENT_PATH}" \
${BASE_OS}:${BASE_DISTRO}
- name: 'Install K from Package'
run: |
Expand Down
20 changes: 10 additions & 10 deletions k-distribution/tests/profiling/post_results_to_develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import sys
import subprocess
from slugify import slugify

COMMIT_SHA = sys.argv[1]
FROM_BRANCH=''
Expand Down Expand Up @@ -38,18 +39,17 @@ def execute_command(command):

print("Exporting last bencher report from", FROM_BRANCH, "to", TO_BRANCH)

# Remove any special characters from the branch name to get the slug
FROM_BRANCH = slugify(FROM_BRANCH)

# This command will generate a JSON file with a list containing the last reports
# sorted in descendenting order for the project.
bencher_command = ["bencher", "report", "list", "--project", "k-framework",
"--sort", "date_time", "--direction", "desc", "--per-page",
"255"]
data = json.loads(execute_command(bencher_command))

# Collect all elemnts where the key 'project' is 'k_framework'
k_framework = [item for item in data if item['project']['slug'] == 'k-framework'
and item['branch']['slug'] == FROM_BRANCH]
bencher_command = ["bencher", "report", "list", "--project", "k-framework",
"--branch", FROM_BRANCH, "--sort", "date_time",
"--direction", "desc"]
reports = json.loads(execute_command(bencher_command))

print("Found", len(k_framework), "reports for k-framework in", FROM_BRANCH)
print("Found", len(reports), "reports for k-framework in", FROM_BRANCH)

# Append the last 6 reports to the list, they correspond to the last performance
# execution on the last commit in FROM_BRANCH
Expand All @@ -58,7 +58,7 @@ def get_name_and_value(item):

data = {}
for i in range(0,6):
item = k_framework[i]
item = reports[i]
results = item['results']
benchmark_name = results[0][0]['benchmarks'][0]['name']
metric_name_memory, value_memory = get_name_and_value(results[0][0])
Expand Down
5 changes: 3 additions & 2 deletions k-distribution/tests/profiling/setup_profiling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
set -euxo pipefail

export DEBIAN_FRONTEND=noninteractive
export BENCHER_VERSION="0.3.10"
export BENCHER_VERSION="0.3.15"
apt-get update
apt-get upgrade --yes
apt-get install --yes python3 git curl make time sudo wget
apt-get install --yes python3 python3-pip git curl make time sudo wget
# Build K if no flag was given and don't execute if flag was given
if [ $# -eq 0 ]; then
apt-get install --yes ./kframework.deb
fi
python3 -m pip install python-slugify

wget https://github.com/bencherdev/bencher/releases/download/v"${BENCHER_VERSION}"/bencher_"${BENCHER_VERSION}"_amd64.deb
sudo dpkg -i bencher_"${BENCHER_VERSION}"_amd64.deb

0 comments on commit 37f2a27

Please sign in to comment.