Skip to content

Use Yarn 4 RC on our CI - #109

Merged
arcanis merged 9 commits into
mainfrom
mael/yarn-4-rc
Jun 1, 2022
Merged

arcanis merged 9 commits into
mainfrom
mael/yarn-4-rc

Conversation

@arcanis

@arcanis arcanis commented May 24, 2022 •

Copy link
Copy Markdown
Contributor

The Yarn releases are quite stable, even RCs, so I'd like to stay up-to-date when possible. It also guards against some lockfile injection attacks.

One major change is that the checked-in cache is now disabled by default since it's only needed in specific situation (typically repositories with large amount of contributions per day); Corepack not being one, I didn't re-enable it in the configuration.

@ljharb

ljharb commented May 24, 2022

Copy link
Copy Markdown
Member

I’m confused; if it’s stable why is it still an RC?

node ships corepack now, and node shouldn’t ship RCs.

@arcanis

arcanis commented May 24, 2022

Copy link
Copy Markdown
Contributor Author

node ships corepack now, and node shouldn’t ship RCs.

I admit the PR title is a little confusing - this PR doesn't change anything to what Corepack distributes (that's what #106 is for). It simply changes the package manager version used to develop on this very repository.

@arcanis arcanis changed the title Upgrades to Yarn 4 RC Use Yarn 4 RC on our CI May 24, 2022
Comment thread .github/workflows/ci.yml Outdated
corepack yarn --immutable --immutable-cache --check-cache
if: |
github.event.pull_request != ''
- run: corepack yarn install

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking suggestion: IIUC, those flags are implicitly enable when Yarn 4 is run from a CI env, correct? While I agree it's a nice default, Iimo it's still worth explicitly adding the files so a human can run the command by copy pasting without needing to learn Yarn's defaults.

Suggested change
- run: corepack yarn install
- run: corepack yarn install --immutable --refresh-lockfile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, --immutable is always on by default on CI; the --refresh-lockfile and --check-resolutions flags are only enabled on PRs (given that they don't run on other branches, making them explicit would impact performances)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We could add a comment explaining that.

Comment thread .github/workflows/ci.yml Outdated
node-version: ${{matrix.node}}.x

- run: corepack yarn install --immutable
- run: corepack yarn install

@aduh95 aduh95 May 24, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary if the previous job has already run the necessary checks?

Suggested change
- run: corepack yarn install

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the chore and ci jobs execute in parallel, both need to run an install (it wasn't the case before because the cache was checked-in).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha I thought we were still on zero-install.

@merceyz merceyz left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the cache isn't committed anymore could you add a actions/cache step?

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@arcanis
arcanis merged commit fb09145 into main Jun 1, 2022
@arcanis
arcanis deleted the mael/yarn-4-rc branch June 1, 2022 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants