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

Fix CI failure due to bumped dependencies in macos-latest GitHub runner #175

Merged
merged 2 commits into from Jan 7, 2024

Conversation

kieran-ryan
Copy link
Sponsor Member

@kieran-ryan kieran-ryan commented Jan 4, 2024

πŸ€” What's changed?

Bumped node-gyp to 10.0.1.

Provided an explicit error message for installation failure of tree-sitter language bindings; prior to attempting their compilation.

> @cucumber/language-service@1.4.1 prepare
> husky install && node scripts/build.js && cp node_modules/web-tree-sitter/tree-sitter.wasm dist

husky - Git hooks installed
Module node_modules/tree-sitter-java does not exist. This is likely due to an installation and/or build failure of the module. Please check the logs.

⚑️ What's your motivation?

Fixes #174 - which prevents the pipeline from passing and presents a blocker to release.

Fix Python 3.12 incompatibility

Following macOS 12 (20231029) release of the macos-latest GitHub runner, the Python distribution changed to 3.12 - this is incompatible with the version of node-gyp used to compile the tree-sitter language bindings. Specifically, our pinned version uses the distutils module which is removed from the standard library 3.12 - which has been discussed on other issues (cucumber/gherkin#40). Our pipelines have failed since this release.

The tree-sitter language binding dependencies were previously made optional to support Windows runners (#58) - suppressing the failure as the logs are less verbose. More information on the failure can be revealed by increasing the log verbosity (-ddd) and by making the dependency required.

As such, the issue is resolved by either pinning Python to 3.9 or updating node-gyp to >= v10 - which is compatible with 3.12. The latter has been chosen, as we will need to bump the version in future in any case.

Improve developer experience with enhanced error message

By first checking if the tree-sitter language binding module exists before attempting to compile them, it makes it clearer what caused the failure. We do not perform this check at present. This can make failures unclear as we trigger the compilation asynchronously so the module that fails can vary based on which process returns the failure first. With this PR, we will not attempt compilation of a missing module - and will get faster CI feedback.

Developers will see the following:

Module node_modules/tree-sitter-java does not exist. This is likely due to an installation and/or build failure of the module. Please check the logs.

Instead of:

Compiling node_modules/tree-sitter-java
Compiling node_modules/tree-sitter-typescript/tsx
Compiling node_modules/tree-sitter-c-sharp
Compiling node_modules/tree-sitter-php
Compiling node_modules/tree-sitter-ruby
Compiling node_modules/tree-sitter-python
Compiling node_modules/tree-sitter-rust
Failed to build wasm for node_modules/tree-sitter-c-sharp: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-c-sharp
Failed to read grammar file "/Users/runner/work/language-service/language-service/node_modules/tree-sitter-c-sharp/src/grammar.json"

🏷️ What kind of change is this?

  • πŸ› Bug fix (non-breaking change which fixes a defect)

πŸ“‹ Checklist:

@kieran-ryan kieran-ryan force-pushed the fix-tree-sitter-ci-failure branch 2 times, most recently from 939804e to dc85cb2 Compare January 7, 2024 17:57
@kieran-ryan kieran-ryan self-assigned this Jan 7, 2024
@kieran-ryan kieran-ryan changed the title Rollback tree-sitter-cli to 0.20.7 due to intermittent CI failures Fix CI failure due to bumped dependencies in macos-latest GitHub runner Jan 7, 2024
@kieran-ryan kieran-ryan added the πŸ› bug Defect / Bug label Jan 7, 2024
@mpkorstanje mpkorstanje merged commit eb6c574 into cucumber:main Jan 7, 2024
6 checks passed
@mpkorstanje
Copy link
Contributor

LGTM, and do feel free to create a branch in this repository instead of your own. It will make collaboration with others easier.

@kieran-ryan
Copy link
Sponsor Member Author

LGTM, and do feel free to create a branch in this repository instead of your own. It will make collaboration with others easier.

Cheers - noted going forward πŸ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ› bug Defect / Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails in CI (intermittently?)
2 participants