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

Fixing develop.yml workflow #3655

Merged
merged 5 commits into from
Sep 21, 2023
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ jobs:
BENCHER_ADAPTER: json
run: |
set -euxo pipefail
workspace=$(pwd)
docker run --name k-posting-profiling-tests-${GITHUB_SHA} \
docker run --name k-posting-profiling-tests-${GITHUB_SHA} \
--rm -it --detach \
-e BENCHER_API_TOKEN=$BENCHER_API_TOKEN \
-e BENCHER_PROJECT=$BENCHER_PROJECT \
Expand All @@ -67,6 +66,7 @@ jobs:
-e GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e GITHUB_REF=$GITHUB_REF \
-e GITHUB_SHA=${GITHUB_SHA} \
--workdir /opt/workspace \
-v "${workspace}:/opt/workspace" \
${BASE_OS}:${BASE_DISTRO}
Expand All @@ -77,14 +77,14 @@ jobs:
- name: 'Getting Performance Tests Results'
run: |
set -euxo pipefail
docker exec -t k-posting-profiling-tests-${GITHUB_SHA} /bin/bash -c './k-distribution/tests/profiling/post_results_to_develop.py'
docker exec -t k-posting-profiling-tests-${GITHUB_SHA} /bin/bash -c './k-distribution/tests/profiling/post_results_to_develop.py ${GITHUB_SHA}'
- name: 'Posting Performance Tests Results'
run: |
set -euxo pipefail
docker exec -t k-posting-profiling-tests-${GITHUB_SHA} /bin/bash -c 'bencher run \
--if-branch "develop" --else-if-branch "master" \
--file .profiling-results.json --err --ci-only-on-alert \
--github-actions "${GITHUB_TOKEN}" 'echo "Exporting report"'
--github-actions "${GITHUB_TOKEN}" "echo Exporting report"'
- name: 'Tear down Docker'
if: always()
run: |
Expand Down
14 changes: 8 additions & 6 deletions k-distribution/tests/profiling/post_results_to_develop.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
import json
import sys
import subprocess

COMMIT_SHA=''
COMMIT_SHA = sys.argv[1]
FROM_BRANCH=''
TO_BRANCH='develop'

Expand All @@ -24,10 +25,6 @@ def execute_command(command):

return result.stdout

# git command to get the last commit in develop
commit_command = [ 'git', 'log', '--format=\"%H\"', '-n', '1' ]
COMMIT_SHA = execute_command(commit_command).strip('\"').strip('\"\n')

# curl command to get the branch name of last commit in develop
API_URL = 'https://api.github.com/repos/runtimeverification/k/commits/' \
+ COMMIT_SHA + '/pulls'
Expand All @@ -36,6 +33,9 @@ def execute_command(command):
'\"X-GitHub-Api-Version:', '2022-11-28\"', API_URL]
FROM_BRANCH = json.loads(execute_command(branch_command))[0]['head']['label']

# If FROM_BRANCH contains user information get only the branch name
if ':' in FROM_BRANCH: FROM_BRANCH = FROM_BRANCH.split(':')[1]

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

# This command will generate a JSON file with a list containing the last reports
Expand All @@ -49,6 +49,8 @@ def execute_command(command):
k_framework = [item for item in data if item['project']['slug'] == 'k-framework'
and item['branch']['slug'] == FROM_BRANCH]

print("Found", len(k_framework), "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
def get_name_and_value(item):
Expand All @@ -64,7 +66,7 @@ def get_name_and_value(item):

branch = item['branch']
print("Appended:", benchmark_name, "created in", item['created'],
"on branch", branch['name'], "with version", branch['version']['number'])
"on branch", branch['name'], "with id", branch['version']['number'])

data.update({benchmark_name: {metric_name_size: {"value": value_size},
metric_name_memory: {"value": value_memory}}
Expand Down