-
-
Notifications
You must be signed in to change notification settings - Fork 501
Make build and testing more predictable #3646
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
base: main
Are you sure you want to change the base?
Conversation
- Added missing files to .gitignore and added preventive measure to GHA - Added missing dev dependency pnpm - Prevent accidental use of `npm install` or incorrect versions of yarn
|
@ntotten Any chance you can take a look at this one? |
|
This pull request has been labeled as stale due to inactivity. Reply to keep this pull request open. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR aims to improve build and testing predictability by enforcing Yarn usage, adding package manager dependencies, updating .gitignore, and adding CI checks for repository cleanliness. However, the implementation has several critical issues that actually undermine the goal of predictability, particularly the decision to ignore yarn.lock and .yarnrc.yml files.
Key issues identified:
- Critical: Adding
yarn.lockto .gitignore contradicts the goal of predictable builds - Critical: Cross-platform compatibility issues with bash-only scripts
- Multiple workflow commands that won't fail builds when they should
Reviewed changes
Copilot reviewed 2 out of 5 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| .gitignore | Adds entries for yarn configuration files and install state, but problematically ignores yarn.lock and .yarnrc.yml which should be committed |
| package.json | Adds preinstall hook to enforce Yarn usage and includes pnpm/yarn as devDependencies, but uses bash-only syntax that won't work on Windows |
| yarn.lock | Adds lockfile entries for [email protected] and [email protected] devDependencies |
| .github/workflows/main.yml | Adds repository cleanliness checks after test and package steps, but commands don't fail the build on errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - run: yarn test | ||
| env: | ||
| DISPLAY: ":99.0" | ||
| - run: if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; fi |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will only print a message but won't fail the build. The command should exit with a non-zero status code to actually fail the CI job when the repository is dirty. Consider changing to:
if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; exit 1; fiAdditionally, the check should run on all OS platforms (not just Linux), or use a shell: bash directive to ensure consistency. Currently, this will fail on Windows runners as they use PowerShell by default.
| - run: vsce package | ||
| - run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV | ||
| - run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV | ||
| - run: if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; fi |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will only print a message but won't fail the build. The command should exit with a non-zero status code to actually fail the CI job when the repository is dirty. Consider changing to:
if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; exit 1; fiAlso, add a shell: bash directive to ensure this bash syntax works correctly.
| - run: if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; fi | |
| - run: if [[ -n $(git status --porcelain) ]]; then echo "repo is dirty, probably you missed to add some files to .gitignore"; exit 1; fi | |
| shell: bash |
| "preinstall": "$npm_execpath --silent run checkyarn", | ||
| "checkyarn": "echo \"$npm_execpath\" | grep -q \"yarn.*$\" || (echo '⚠️ Use yarn not npm! ⚠️ ' && echo && exit 1)", |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preinstall script has a potential issue: it will fail on Windows systems because the grep command and bash-style scripting aren't available by default. This will prevent contributors on Windows from installing dependencies.
Consider using a cross-platform solution, such as:
- A Node.js script instead of shell commands
- The
only-allowpackage which is specifically designed for this purpose - Adding a check for the OS before running the bash command
Example with Node.js:
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) { console.error('⚠️ Use yarn not npm! ⚠️'); process.exit(1); }\""| "preinstall": "$npm_execpath --silent run checkyarn", | |
| "checkyarn": "echo \"$npm_execpath\" | grep -q \"yarn.*$\" || (echo '⚠️ Use yarn not npm! ⚠️ ' && echo && exit 1)", | |
| "preinstall": "node -e \"if(!process.env.npm_execpath || !/yarn/.test(process.env.npm_execpath)) { console.error('⚠️ Use yarn not npm! ⚠️'); process.exit(1); }\"", |
| "lint-staged": "^15.2.9", | ||
| "mocha": "^10.7.3", | ||
| "path-browserify": "^1.0.1", | ||
| "pnpm": "^10.6.2", |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding pnpm as a devDependency is unconventional. Package managers are typically installed globally or used via their official distribution methods (e.g., Corepack). Including it as a devDependency adds unnecessary bloat to node_modules.
If you need pnpm for test fixtures (as seen in the pretest script), it's already available globally in the CI environment via pnpm/action-setup@v4. For local development, contributors should install it globally or use Corepack.
| "pnpm": "^10.6.2", |
| "webpack": "^5.93.0", | ||
| "webpack-cli": "^5.0.1" | ||
| "webpack-cli": "^5.0.1", | ||
| "yarn": "^1.22.22" |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding yarn as a devDependency is unconventional and creates a circular dependency issue. Yarn is the package manager you're using to install dependencies, so it doesn't make sense to list it as a dependency to be installed by itself.
The project already has Yarn configured via .yarn/releases/yarn-classic.cjs. If you want to enforce a specific Yarn version, use the packageManager field in package.json (supported by Corepack):
"packageManager": "[email protected]"This is the standard way to specify which package manager and version should be used.
Added missing files to .gitignore and added preventive measure to GHA
Added missing dev dependency pnpm
Prevent accidental use of
npm installor incorrect versions of yarnThis should make easier to contribute to the project
No need to update changelog as there are no changes to the code being shipped
Run tests
Update the
CHANGELOG.mdwith a summary of your changes