Add benchmarks comparing job
This commit is contained in:
parent
bc4b07ee9e
commit
2662f3fbd4
48
.github/workflows/osrm-backend.yml
vendored
48
.github/workflows/osrm-backend.yml
vendored
@ -359,20 +359,20 @@ jobs:
|
|||||||
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
# restore-keys: |
|
# restore-keys: |
|
||||||
# ${{ runner.os }}-node-
|
# ${{ runner.os }}-node-
|
||||||
# - name: Enable compiler cache
|
# - name: Enable compiler cache
|
||||||
# uses: actions/cache@v3
|
# uses: actions/cache@v3
|
||||||
# with:
|
# with:
|
||||||
# path: ~/.ccache
|
# path: ~/.ccache
|
||||||
# key: ccache-${{ matrix.name }}-${{ github.sha }}
|
# key: ccache-${{ matrix.name }}-${{ github.sha }}
|
||||||
# restore-keys: |
|
# restore-keys: |
|
||||||
# ccache-${{ matrix.name }}-
|
# ccache-${{ matrix.name }}-
|
||||||
# - name: Enable Conan cache
|
# - name: Enable Conan cache
|
||||||
# uses: actions/cache@v3
|
# uses: actions/cache@v3
|
||||||
# with:
|
# with:
|
||||||
# path: ~/.conan
|
# path: ~/.conan
|
||||||
# key: v9-conan-${{ matrix.name }}-${{ github.sha }}
|
# key: v9-conan-${{ matrix.name }}-${{ github.sha }}
|
||||||
# restore-keys: |
|
# restore-keys: |
|
||||||
# v9-conan-${{ matrix.name }}-
|
# v9-conan-${{ matrix.name }}-
|
||||||
# - name: Enable test cache
|
# - name: Enable test cache
|
||||||
# uses: actions/cache@v3
|
# uses: actions/cache@v3
|
||||||
# with:
|
# with:
|
||||||
@ -611,12 +611,26 @@ jobs:
|
|||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Enable compiler cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.ccache
|
||||||
|
key: v1-ccache-benchmarks-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
v1-ccache-benchmarks-
|
||||||
|
- name: Enable Conan cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.conan
|
||||||
|
key: v1-conan-benchmarks-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
v1-conan-benchmarks-
|
||||||
- name: Checkout PR Branch
|
- name: Checkout PR Branch
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
path: pr
|
path: pr
|
||||||
- run: pip install "conan<2.0.0"
|
- run: python3 -m pip install "conan<2.0.0" "requests==2.31.0"
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p pr/build
|
mkdir -p pr/build
|
||||||
@ -628,7 +642,7 @@ jobs:
|
|||||||
make -C test/data
|
make -C test/data
|
||||||
- name: Run Benchmark on Master Branch
|
- name: Run Benchmark on Master Branch
|
||||||
run: |
|
run: |
|
||||||
./pr/build/src/benchmarks/match-bench ../test/data/mld/monaco.osrm mld > pr_bench.txt
|
./pr/build/src/benchmarks/match-bench ./pr/test/data/mld/monaco.osrm mld > pr_bench.txt
|
||||||
- name: Checkout Master Branch
|
- name: Checkout Master Branch
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -645,7 +659,7 @@ jobs:
|
|||||||
make -C test/data
|
make -C test/data
|
||||||
- name: Run Benchmark on Master Branch
|
- name: Run Benchmark on Master Branch
|
||||||
run: |
|
run: |
|
||||||
./master/build/src/benchmarks/match-bench ../test/data/mld/monaco.osrm mld > master_bench.txt
|
./master/build/src/benchmarks/match-bench ./master/test/data/mld/monaco.osrm mld > master_bench.txt
|
||||||
- name: Compare Benchmarks
|
- name: Compare Benchmarks
|
||||||
run: |
|
run: |
|
||||||
cat pr_bench.txt
|
cat pr_bench.txt
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
# GitHub token and repository details
|
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
||||||
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN') # Ensure this token has repo and workflow permissions
|
|
||||||
REPO = os.getenv('GITHUB_REPOSITORY')
|
REPO = os.getenv('GITHUB_REPOSITORY')
|
||||||
PR_NUMBER = os.getenv('PR_NUMBER') # Ensure this is set in the GitHub Actions environment
|
PR_NUMBER = os.getenv('PR_NUMBER')
|
||||||
|
|
||||||
REPO_OWNER, REPO_NAME = REPO.split('/')
|
REPO_OWNER, REPO_NAME = REPO.split('/')
|
||||||
|
|
||||||
@ -36,11 +36,22 @@ def update_comment(comment_id, repo_owner, repo_name, body):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
comments = get_pr_comments(REPO_OWNER, REPO_NAME, PR_NUMBER)
|
comments = get_pr_comments(REPO_OWNER, REPO_NAME, PR_NUMBER)
|
||||||
if comments:
|
if comments and len(comments) > 0:
|
||||||
first_comment = comments[0]
|
first_comment = comments[0]
|
||||||
markdown_table = create_markdown_table(benchmark_results)
|
markdown_table = create_markdown_table(benchmark_results)
|
||||||
new_body = f"{first_comment['body']}\n\n### Benchmark Results\n{markdown_table}"
|
new_benchmark_section = f"<!-- BENCHMARK_RESULTS_START -->\n## Benchmark Results\n{markdown_table}\n<!-- BENCHMARK_RESULTS_END -->"
|
||||||
update_comment(first_comment['id'], REPO_OWNER, REPO_NAME, new_body)
|
|
||||||
|
if re.search(r'<!-- BENCHMARK_RESULTS_START -->.*<!-- BENCHMARK_RESULTS_END -->', first_comment['body'], re.DOTALL):
|
||||||
|
updated_body = re.sub(
|
||||||
|
r'<!-- BENCHMARK_RESULTS_START -->.*<!-- BENCHMARK_RESULTS_END -->',
|
||||||
|
new_benchmark_section,
|
||||||
|
first_comment['body'],
|
||||||
|
flags=re.DOTALL
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
updated_body = f"{first_comment['body']}\n\n{new_benchmark_section}"
|
||||||
|
|
||||||
|
update_comment(first_comment['id'], REPO_OWNER, REPO_NAME, updated_body)
|
||||||
print("PR comment updated successfully.")
|
print("PR comment updated successfully.")
|
||||||
else:
|
else:
|
||||||
print("No comments found on this PR.")
|
print("No comments found on this PR.")
|
||||||
|
Loading…
Reference in New Issue
Block a user