From 07901de41614c55d8abaf74faaca61876b788f84 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Sun, 22 Oct 2023 17:31:12 -0400 Subject: [PATCH 1/3] Allow to run the benchmark workflow from PRs when the "run-benchmark" label is present Signed-off-by: Jean-Christophe Morin --- .github/scripts/store_benchmark.py | 3 ++- .github/workflows/benchmark.yaml | 17 +++++++++++++++-- src/rez/utils/_version.py | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/scripts/store_benchmark.py b/.github/scripts/store_benchmark.py index 79fec9eab..d8cbb8c1e 100644 --- a/.github/scripts/store_benchmark.py +++ b/.github/scripts/store_benchmark.py @@ -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) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 17828cbc7..e5a2207ad 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -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: @@ -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 @@ -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 @@ -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" diff --git a/src/rez/utils/_version.py b/src/rez/utils/_version.py index 08ae7bcb8..35a7ec6ae 100644 --- a/src/rez/utils/_version.py +++ b/src/rez/utils/_version.py @@ -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" From fcb49438ea6f4e4cbebaa46f93f4835966339c07 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Thu, 26 Oct 2023 20:26:47 -0400 Subject: [PATCH 2/3] Revert version change Signed-off-by: Jean-Christophe Morin --- src/rez/utils/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rez/utils/_version.py b/src/rez/utils/_version.py index 35a7ec6ae..25be5f085 100644 --- a/src/rez/utils/_version.py +++ b/src/rez/utils/_version.py @@ -4,4 +4,4 @@ # Update this value to version up Rez. Do not place anything else in this file. # Using .devN allows us to run becnmarks and create proper benchmark reports on PRs. -_rez_version = "2.114.0.dev1" +_rez_version = "2.113" From 3594582b87455c38d9805c57015c63fd23493878 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Thu, 26 Oct 2023 21:09:43 -0400 Subject: [PATCH 3/3] Add job summary Signed-off-by: Jean-Christophe Morin --- .github/workflows/benchmark.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index e5a2207ad..171f96ed7 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -21,12 +21,6 @@ jobs: - '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 @@ -132,6 +126,14 @@ jobs: python ./.github/scripts/store_benchmark.py working-directory: src + - name: Create summary + run: | + echo '
' >> $GITHUB_STEP_SUMMARY + echo 'Results' >> $GITHUB_STEP_SUMMARY + cat metrics/benchmarking/RESULTS.md >> $GITHUB_STEP_SUMMARY + echo '
' >> $GITHUB_STEP_SUMMARY + working-directory: src + - name: Setup git config if: ${{ github.event_name == 'release' }} run: |