Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] The suggested CI script should only reinstall dependencies if they changed between baseline branch and target branch #449

Open
sbalay opened this issue Jan 28, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@sbalay
Copy link

sbalay commented Jan 28, 2024

Describe the improvement
The current docs suggested the following script to run this tool on CI:

#!/usr/bin/env bash
set -e

BASELINE_BRANCH=${BASELINE_BRANCH:="main"}

# Required for `git switch` on CI
git fetch origin

# Gather baseline perf measurements
git switch "$BASELINE_BRANCH"
yarn install --force
yarn reassure --baseline

# Gather current perf measurements & compare results
git switch --detach -
yarn install --force
yarn reassure

It would be nice to only run the second yarn install --force if the lockfile of the target branch is different from the baseline branch.

Scope of improvement
The CI script

Suggested implementation steps
Maybe hash the lockfile while on the baseline branch and then rehash it after switching to the target branch. Finally compare both hashes and run yarn install --force on the target branch based on the comparison result

@mdjastrzebski
Copy link
Member

Interesting idea, you are right that yarn install --force is frequently wasteful if yarn did not change. This code is part of the user script (reassure-tests.sh) that each user has to create on the CI. It is also dependent on the package manager used (npm, yarn, pnpm, etc). What we could do in Reassure codebase is to provide a better template that would calculate the hash and run 1st and 2nd install conditionally.

@sbalay Would you be able to investigate such shell script modifications and submit a PR for it?

@mdjastrzebski mdjastrzebski added the help wanted Extra attention is needed label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants