langium icon indicating copy to clipboard operation
langium copied to clipboard

Ensure that generator-langium and langium:generator are in sync

Open danieldietrich opened this issue 3 years ago • 1 comments

The Langium extension generator generator-langium is scaffolding new Langium projects. In particular, it generates the Langium configuration read by the langium generate CLI command.

generator-langium and langium are different packages. As a Langium maintainer, I want to ensure that both packages don't break their common contract (e.g. the Langium configuration format).

A solution could be that we add an additional CI task in the form of a GitHub Action that runs generator-langium as an integration test. More specifically, the Action could install Yeoman and npm link the package generator-langium in order to be able to run yo langium. Within the resulting hello world project, we could run the langium:generate script and check the generated output.

  • A first smoke test could be to check if the langium:generate script runs with exit code 0.
  • A more sophisticated test could check if generated contents match expected contents (via snapshots?)

danieldietrich avatar Mar 01 '22 19:03 danieldietrich

A big challenge here is that the generated npm package pulls langium and langium-cli from the npm registry, but its contents may be already using new API from the next version (main branch). I tested the current state and it fails because it uses the old version 0.2.0. If you change that to use the local version from the repository, everything works fine. So an integration test needs to ensure that the local version is used instead of a published version.

spoenemann avatar Mar 03 '22 07:03 spoenemann

I think, the first step is to add an automatic test that at least ensures that the generator-langium works with the current codebase. I will take a look

dhuebner avatar Dec 16 '22 08:12 dhuebner

@danieldietrich @spoenemann I've added a yeoman-generator test that will fail if for example generated source files can not be compiled. See #843

dhuebner avatar Dec 16 '22 13:12 dhuebner

We have compile tests for generator-langium now.

spoenemann avatar May 23 '23 05:05 spoenemann