power-grid-model icon indicating copy to clipboard operation
power-grid-model copied to clipboard

[FEATURE] Action to check that the generated code is up to date

Open mgovers opened this issue 11 months ago • 0 comments

  • the code_generation/ directory contains the code generator including its configuration.
  • It is important that the generated code is up to date. i.e.:
    • no manual code changes were made to generated files; generated files should remain generated
    • the generated files are up to date with the latest code generator including its input configuration

This issue is about adding a github action check that that is indeed the case.

TODO

  • [ ] Update all files in the code_generation/templates/ directory
    • [ ] Those files currently contain the string This header file is automatically generated. DO NOT modify it manually!
    • [ ] There is at least one CPP file that is clearly not a header file but does contain the string header. That is clearly wrong (as it's not a header but a CPP file)
    • [ ] Instead, the string should be: This file is automatically generated. DO NOT modify it manually!
    • [ ] Run the code_generation/code_gen.py file to update all generated files and check them in
  • [ ] Create the github action
    • [ ] Install all dependencies (found in code_generation/requirements.txt)
    • [ ] Run code_generation/code_gen.py
    • [ ] Check that the git status is empty
      • [ ] should pass if it is empty
      • [ ] should fail action if it isn't empty and list the changed files
      • [ ] look up the exact command in the git documentation to do this
    • [ ] To prevent unnecessary checks, the action should only run if and only if the following checked-in files and directories are changed:
      • [ ] code_generation/
      • [ ] All files and directories that contain the string This file is automatically generated. DO NOT modify it manually!
        • [ ] In particular, those are the files that the templates code_generation/templates/ map to
        • [ ] That is: code_generation/templates/x/.../y.z maps to x/.../y.z

mgovers avatar Mar 13 '24 16:03 mgovers