cucumber / language-service

Cucumber Language Service
MIT License
12 stars 21 forks source link

Build fails in CI (intermittently?) #174

Closed mpkorstanje closed 4 months ago

mpkorstanje commented 4 months ago

👓 What did you see?

Builds are failing intermittently when compiling some tree sitter modules, e.g:

https://github.com/cucumber/language-service/actions/runs/6752791276/job/18358568725

 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
Failed to build wasm for node_modules/tree-sitter-typescript/tsx: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-typescript/tsx
Compiling node_modules/tree-sitter-python
Failed to read grammar file "/Users/runner/work/language-service/language-service/node_modules/tree-sitter-typescript/tsx/src/grammar.json"
Compiling node_modules/tree-sitter-rust

Caused by:
    No such file or directory (os error 2)

https://github.com/cucumber/language-service/actions/runs/7152098907/job/19477061875

 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"

Caused by:
    No such file or directory (os error 2)

📚 Any additional context?

I'm not familiar with this stack.

mpkorstanje commented 4 months ago

@xeger any clue?

kieran-ryan commented 4 months ago

@mpkorstanje, appears to be an open issue with tree-sitter-cli 0.20.8 (which we use), whereby parser generation varies across operating systems - tree-sitter/tree-sitter#2755.

This is potentially what's happening in our case due to files not being generated/found.

If that's the case, other than awaiting a fix, rolling back to 0.20.7 and preventing automerge should hopefully resolve the issue for the time being.

Edit: Will try to validate this assumption

xeger commented 4 months ago

Argh; this is the second time Tree sitter has had an obscure wasm bug. Suggest testing the rolled back build against the vscode plugin to ensure the electron wasm linking issue is not present in the older Tree sitter artifacts.

kieran-ryan commented 4 months ago

Raised a PR that resolves the issue. Caused by macos-latest updating Python to 3.12 - with a breaking change in our pinned version of node-gyp due to removal of distutils from the standard library. The tree-sitter language bindings subsequently failed to build on installation and the root-cause of failure was suppressed due to the low verbosity of the logs and as they are specified as optional dependencies - which allows the run to continue to the compilation script even if failures are present.

Varying output was a result of our script asynchronously attempting compilation of each of the tree-sitter language bindings - and the failure observed being the first process that finished.