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

Using DangerJS to check changes coupling of implementation files to test or documentation files #2523

Merged
merged 7 commits into from
Apr 25, 2024

Conversation

KevinEyo1
Copy link
Contributor

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
#2140
Added a workflow that utilizes DangerJS to check that certain implementation files having changes, has changes in its corresponding test or documentation files.

Anything you'd like to highlight/discuss:
Currently run on pull_request and logs the error in CI logs. Does not include implementation of manual/automatic coupling of files. Once that is implemented with good accuracy, workflow can change to failing the check instead of just logging the error.

Testing instructions:
Based on test couplings, proper error logs should be found in CI logs

Proposed commit message: (wrap lines at 72 characters)
It can be easy to miss out on updating test or documentation files
when implementing or changing features.

Let's add a workflow utilizing DangerJS to aid in checking and
alerting developers if they forget to do so.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

@KevinEyo1 KevinEyo1 marked this pull request as ready for review April 22, 2024 09:22
@KevinEyo1 KevinEyo1 marked this pull request as draft April 22, 2024 09:23
Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

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

Some initial comments!

Dangerfile.js Outdated Show resolved Hide resolved
Dangerfile.js Outdated Show resolved Hide resolved
Dangerfile.js Outdated Show resolved Hide resolved
echo "$ERROR_LOGS"
env:
RESULT: ${{ env.RESULT }}
ERROR_LOGS: ${{env.ERROR_LOGS}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add permissions for this workflow?

.github/workflows/check-file-diff.yml Outdated Show resolved Hide resolved
@KevinEyo1 KevinEyo1 marked this pull request as ready for review April 23, 2024 13:12
Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

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

Some comments!

package.json Show resolved Hide resolved
Dangerfile.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this to TS!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I will work on it.

Dangerfile.js Outdated
const allModifiedFiles = [...git.modified_files, ...git.created_files];
const messages = [];

Object.entries(couplings).forEach(([implFile, testOrDocFiles]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense to me in theory, but given that the sample couplings you have here are package.json and either lerna or babel, which is not a TestOrDoc file, I think reading this code is confusing. Maybe we should name it as "dependent files" or something?

Or maybe this isn't such a good example of a coupling? You could put site and site test maybe 🤔

@KevinEyo1 KevinEyo1 reopened this Apr 24, 2024
Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

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

Last nit and I think we should be good to go!

dangerfile.ts Show resolved Hide resolved
Copy link
Contributor

@kaixin-hc kaixin-hc left a comment

Choose a reason for hiding this comment

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

changes look good - added a nit about how it should be logged.

i am concerned about people not checking console logs for CI, its a lot more troublesome and honestly wouldn't occur to me. But since this is a piece by piece implementation and you've mentioned you'd like to look at generating an automated list of reliant files, I think it is OK for now

EDIT: Also tests are failing - do fix thanks

dangerfile.ts Outdated
});

if (messages.length > 0) {
logger.info(`Detected issues with file couplings:\n${messages.join('\n')}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe log it as a warning?

dangerfile.ts Outdated
'packages/core/src/html/CustomListIconProcessor.ts': [
'docs/userGuide/syntax/lists.md',
'packages/cli/test/functional/test_site/testList.md',
'packages/cli/test/functional/test_site/expected/testList.html',
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm tbh i feel like there isn't a need to add the .html and .page-vue-render.js files here. Because they will have to updated otherwise the tests will fail automatically.

Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the work

@KevinEyo1 KevinEyo1 merged commit 178de14 into MarkBind:master Apr 25, 2024
8 checks passed
Copy link

@KevinEyo1 Each PR must have a SEMVER impact label, please remember to label the PR properly.

@KevinEyo1 KevinEyo1 added the r.Patch Version resolver: increment by 0.0.1 label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r.Patch Version resolver: increment by 0.0.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants