Skip to content

Commit

Permalink
Add ability to run the benchmark workflow from PRs (#1555)
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
JeanChristopheMorinPerso authored Oct 27, 2023
1 parent cfc333e commit 371644d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/store_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def store_result():
destdir = '-'.join((
time.strftime("%Y.%m.%d"),
"%d.%d" % sys.version_info[:2],
_rez_version
# TODO: We could read the version from summary.json...
_rez_version,
))

destpath = os.path.join(artifacts_dir, destdir)
Expand Down
31 changes: 23 additions & 8 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@ name: benchmark
on:
release:
types: [released]
pull_request:
types: [opened, synchronize, reopened, labeled]

jobs:
run_benchmark:
name: run_benchmark
runs-on: ubuntu-latest

if: ${{ github.event_name == 'release' || contains(github.event.pull_request.labels.*.name, 'run-benchmarks') }}

strategy:
matrix:
python-version:
- '2.7'
- '3.7'

# without this, we're sometimes getting at the end of this job:
# '[error] The operation was canceled'.
# Do we hit a resource limit?
#
max-parallel: 1

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -84,8 +82,9 @@ jobs:
name: "benchmark-result-${{ matrix.python-version }}"
path: .

- name: Checkout
- name: Checkout (release)
uses: actions/checkout@v3
if: ${{ github.event_name =='release' }}
with:
ref: main
path: src
Expand All @@ -96,8 +95,14 @@ jobs:
#
token: "${{ secrets.GH_ACTION_TOKEN }}"

- name: Checkout (pr)
uses: actions/checkout@v3
if: ${{ github.event_name !='release' }}
with:
path: src

- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
uses: ./src/.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: ubuntu-latest
Expand All @@ -121,13 +126,23 @@ jobs:
python ./.github/scripts/store_benchmark.py
working-directory: src

- name: Create summary
run: |
echo '<details>' >> $GITHUB_STEP_SUMMARY
echo '<summary>Results</summary>' >> $GITHUB_STEP_SUMMARY
cat metrics/benchmarking/RESULTS.md >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
working-directory: src

- name: Setup git config
if: ${{ github.event_name == 'release' }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
working-directory: src

- name: Git commit and push
if: ${{ github.event_name == 'release' }}
run: |
if [[ "$(git status --porcelain)" == "" ]]; then
echo "Nothing new to commit"
Expand Down
3 changes: 2 additions & 1 deletion src/rez/utils/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@


# Update this value to version up Rez. Do not place anything else in this file.
_rez_version = "2.113.0"
# Using .devN allows us to run becnmarks and create proper benchmark reports on PRs.
_rez_version = "2.113"

0 comments on commit 371644d

Please sign in to comment.