Skip to content

Commit

Permalink
Allow to run the benchmark workflow from PRs when the "run-benchmark"…
Browse files Browse the repository at this point in the history
… label is present

Signed-off-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
JeanChristopheMorinPerso committed Oct 23, 2023
1 parent 73e7493 commit 07901de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 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
17 changes: 15 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ 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:
Expand Down Expand Up @@ -84,8 +88,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 +101,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 @@ -122,12 +133,14 @@ jobs:
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.114.0.dev1"

0 comments on commit 07901de

Please sign in to comment.