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

ci: add codeQuality job to run lint and format task #3922

Merged

Conversation

marcalexiei
Copy link
Contributor

Description

Add a new codeQuality job inside CI workflow.
The new job runs before build and nodeJsBaselineAptCompatibility.

Executed task are:

  1. yarn build
  2. yarn format
  3. yarn lint

This should avoid lints error addition if someone forgets to run yarn lint.

Motivation and Context

During #3850 I noticed that a lint issue fix was performed with a separate commit.

Basically config-nx-scopes was missing @commitlint/types dependency and running yarn lint shows that error.

You can see the same fix also on the fix lodash PR

Usage examples

N/A

How Has This Been Tested?

N/A

Types of changes

  • Github actions
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@marcalexiei marcalexiei changed the title ci: add codeQuality task to run lint and format task ci: add codeQuality job to run lint and format task Feb 17, 2024
@marcalexiei marcalexiei force-pushed the feature/linting-ci branch 2 times, most recently from eb90dd4 to ea4f7bb Compare February 17, 2024 07:56
@escapedcat
Copy link
Member

Ohhh, wow, I was just wondering because I thought we already have this.
But we lost it when switching from CircleCI to Github Actions. Well, I forgot to migrate these...
Would you mind having a look if any of the other tasks should be re-added, like audit or deps (not sure what that actually does)

@marcalexiei
Copy link
Contributor Author

marcalexiei commented Feb 17, 2024

Sure, no problem!
Would you like to have a new PR for the task "restoration", or I just keep updating this one?
(I personally prefer the first option to speed up things since the task of this PR is completed)

@escapedcat
Copy link
Member

Just in here is fine, thank you so much!

.github/workflows/CI.yml Outdated Show resolved Hide resolved
@marcalexiei
Copy link
Contributor Author

@escapedcat

audit task

are you sure do you want to run yarn audit inside CI?
Right now there 28 vulnerabilities:

  • 18 Moderate
  • 10 High

Besides that I think that dependabot / renovatebot will take care to open PR for this kind of issues when the fix is available.


deps task

This task which is present in every package runs a script inside @packages/utils folder:

https://github.com/conventional-changelog/commitlint/blob/master/%40packages/utils/dep-check.js

To be honest I'm not sure what is its purpose. Do you have any idea?

Right now is failing silently (err.exitCode is undefined so the process doesn't issue an error):

image

return Promise.all([
check(['--missing', '--no-dev', '.']),
check(['--extra', '--no-dev', '.']),
])
.then((tasks) => [null, tasks.map((t) => t.stdout).join('\n')])
.catch((err) => [err]);


pkg task

Alongside deps task there is also a pkg task which performs some check on the output of yarn pack command.

This one is failing right now:

Screenshot 2024-02-19 at 09 28 50

Conclusion

If we have to restore pkg and deps tasks,
I strongly recommend to do this separately from this PR due to the fact that are not working right now.

.github/workflows/CI.yml Outdated Show resolved Hide resolved
.github/workflows/CI.yml Outdated Show resolved Hide resolved
@escapedcat
Copy link
Member

If we have to restore pkg and deps tasks,
I strongly recommend to do this separately from this PR due to the fact that are not working right now.

Sure, let's do this.
We can think about if these are needed, same for the audit one. I mentioned these because those were existing before. We can reconsider if these add any value and should be re-added.

@knocte
Copy link
Contributor

knocte commented Feb 19, 2024

And the last nit from me is that, given that now codeQuality executes after build, then it's more logical to place its code after the build step, for readability. Other than that, LGTM

@escapedcat
Copy link
Member

@marcalexiei wanna move the task below the build one as knocte suggested?
I guess then we're done with all the nitting (FTW!) and we can merge this.
Thanks for keep doing this!

btw, if any of you is interested you can join the new discord channel, which is is just empty currently:
#3522 (comment)

@marcalexiei
Copy link
Contributor Author

All changes have been applied.

@escapedcat escapedcat merged commit dccc081 into conventional-changelog:master Feb 19, 2024
6 checks passed
@marcalexiei marcalexiei deleted the feature/linting-ci branch February 19, 2024 11:20
@escapedcat
Copy link
Member

@knocte After switching everything to ESM and therefor to node v20 you know how to handle this?:
https://github.com/conventional-changelog/commitlint/actions/runs/7958768184/job/21724308968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants