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

Add check for dist/ directory consistent with source files #766

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

MikeMcC399
Copy link
Collaborator

This PR addresses issue #706 "Add build & diff "/dist" folder workflow".

It adds a new workflow .github/workflows/check-dist.yml which checks for consistency between source files and the generated contents of the master/dist directory.

If the source files and master/dist are consistent then the workflow succeeds.

If the source files and master/dist are not consistent then the workflow fails.

Verification

Test on Ubuntu 22.04.

Error case

Make a change to master/index.js, for instance, add the following to the top of the source code:

const workflowTest = true

Commit the change
Run the workflow .github/workflows/check-dist.yml
Check that the workflow fails, with the message:

"Detected uncommitted changes after build. See status below:"

Non-error case

Following on from above, execute:

npm run format
npm run build

Commit the change and retest.

Check that the workflow now succeeds.

Cross-platform compatibility

After achieving a successful result on Ubuntu 22.04 sync the branch from above onto a Windows 11 platform, then execute:

npm run format
npm run build

Confirm that there are no changes whilst ignoring end-of-line changes:

git diff --ignore-space-at-eol

and note the warnings:

warning: in the working copy of 'dist/thread.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'index.js', LF will be replaced by CRLF the next time Git touches it

Confirm that there are changes:

git diff

Commit these changes and retest.

Check that the workflow still succeeds despite having replaced the Ubuntu generated dist/index.js with a Windows generated version.

@MikeMcC399
Copy link
Collaborator Author

@jaffrepaul

This issue is ready for review and merge.

@MikeMcC399 MikeMcC399 marked this pull request as ready for review February 1, 2023 16:12
@MikeMcC399
Copy link
Collaborator Author

After gaining some practical experience with the workflow it should be considered for addition to the status checks in the branch protection rules.

Copy link
Contributor

@jaffrepaul jaffrepaul left a comment

Choose a reason for hiding this comment

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

Awesome, glad to see this addition. Should be very useful.

@jaffrepaul jaffrepaul merged commit 659e120 into cypress-io:master Feb 10, 2023
@MikeMcC399 MikeMcC399 deleted the fix/action-consistency branch February 10, 2023 16:36
@MikeMcC399
Copy link
Collaborator Author

@jaffrepaul

Awesome, glad to see this addition. Should be very useful.

It should definitely catch the error condition if the update commands have not been executed:

npm run format
npm run build

@github-actions
Copy link

🎉 This PR is included in version 5.0.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants