From 542960007d4538d1c902b55006ecd459918298d5 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 8 Nov 2024 22:44:14 +0100 Subject: [PATCH 1/4] don't include arguments when not running against a PR --- .circleci/config.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51de43a71e69..7f0d6b6b2d99 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -221,7 +221,7 @@ jobs: - attach_workspace: at: . - run: - name: Benchmarking Packages + name: Starting local registry working_directory: scripts command: | yarn local-registry --open & @@ -229,7 +229,28 @@ jobs: echo 'Waiting for local registry to be available...' sleep 2 done - yarn bench-packages --baseBranch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload + # if there is a base branch AND a PR number in parameters, benchmark packages against those + # this happens when run against a PR + - when: + condition: + and: + - << pipeline.parameters.ghBaseBranch >> + - << pipeline.parameters.ghPrNumber >> + steps: + - run: + name: Benchmarking packages against base branch + command: yarn bench-packages --baseBranch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload + # if there is a NOT a base branch OR NOT a PR number in parameters, just upload benchmarks for the branch + # this happens when runned directly on branches, like next or main + - when: + condition: + or: + - not: << pipeline.parameters.ghBaseBranch >> + - not: << pipeline.parameters.ghPrNumber >> + steps: + - run: + name: Uploading package benchmarks for branch + command: yarn bench-packages --upload - store_artifacts: path: bench/packages/results.json - store_artifacts: From 85ff112345f7a02abe294a5de176a2c8ee8d8f31 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 8 Nov 2024 22:49:27 +0100 Subject: [PATCH 2/4] fix baseBranch typo --- .circleci/config.yml | 2 +- scripts/bench/bench-packages.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f0d6b6b2d99..07eec63ffc3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ jobs: steps: - run: name: Benchmarking packages against base branch - command: yarn bench-packages --baseBranch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload + command: yarn bench-packages --base-branch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload # if there is a NOT a base branch OR NOT a PR number in parameters, just upload benchmarks for the branch # this happens when runned directly on branches, like next or main - when: diff --git a/scripts/bench/bench-packages.ts b/scripts/bench/bench-packages.ts index fa12505e5d42..1651f5507301 100644 --- a/scripts/bench/bench-packages.ts +++ b/scripts/bench/bench-packages.ts @@ -370,7 +370,7 @@ const uploadToGithub = async ({ const run = async () => { program .option( - '-b, --baseBranch ', + '-b, --base-branch ', 'The base branch to compare the results with. Requires GCP_CREDENTIALS env var' ) .option( From c0b80a1f5db30673a43286eef6058ffa32404a93 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 8 Nov 2024 23:16:48 +0100 Subject: [PATCH 3/4] add working dir --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 07eec63ffc3f..6cbdda2ea645 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,6 +239,7 @@ jobs: steps: - run: name: Benchmarking packages against base branch + working_directory: scripts command: yarn bench-packages --base-branch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload # if there is a NOT a base branch OR NOT a PR number in parameters, just upload benchmarks for the branch # this happens when runned directly on branches, like next or main @@ -250,6 +251,7 @@ jobs: steps: - run: name: Uploading package benchmarks for branch + working_directory: scripts command: yarn bench-packages --upload - store_artifacts: path: bench/packages/results.json From 844e48e4d4bc95ef35859172631fd3be3eb27ac9 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Sat, 9 Nov 2024 20:15:20 +0100 Subject: [PATCH 4/4] inline starting local registry --- .circleci/config.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6cbdda2ea645..1171aba46fe1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -220,15 +220,6 @@ jobs: clone_options: "--depth 1 --verbose" - attach_workspace: at: . - - run: - name: Starting local registry - working_directory: scripts - command: | - yarn local-registry --open & - until curl -s http://localhost:6001 > /dev/null; do - echo 'Waiting for local registry to be available...' - sleep 2 - done # if there is a base branch AND a PR number in parameters, benchmark packages against those # this happens when run against a PR - when: @@ -240,7 +231,13 @@ jobs: - run: name: Benchmarking packages against base branch working_directory: scripts - command: yarn bench-packages --base-branch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload + command: | + yarn local-registry --open & + until curl -s http://localhost:6001 > /dev/null; do + echo 'Waiting for local registry to be available...' + sleep 2 + done + yarn bench-packages --base-branch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload # if there is a NOT a base branch OR NOT a PR number in parameters, just upload benchmarks for the branch # this happens when runned directly on branches, like next or main - when: @@ -252,7 +249,13 @@ jobs: - run: name: Uploading package benchmarks for branch working_directory: scripts - command: yarn bench-packages --upload + command: | + yarn local-registry --open & + until curl -s http://localhost:6001 > /dev/null; do + echo 'Waiting for local registry to be available...' + sleep 2 + done + yarn bench-packages --upload - store_artifacts: path: bench/packages/results.json - store_artifacts: