diff --git a/.circleci/config.yml b/.circleci/config.yml index 51de43a71e69..1171aba46fe1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -220,16 +220,42 @@ jobs: clone_options: "--depth 1 --verbose" - attach_workspace: at: . - - run: - name: Benchmarking Packages - 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 - 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 + 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 + 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: + condition: + or: + - not: << pipeline.parameters.ghBaseBranch >> + - not: << pipeline.parameters.ghPrNumber >> + steps: + - run: + name: Uploading package benchmarks for branch + 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 + yarn bench-packages --upload - store_artifacts: path: bench/packages/results.json - store_artifacts: 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(