amplify-edge / sys

system
Apache License 2.0
0 stars 2 forks source link

Booty - mage it #106

Closed joe-getcouragenow closed 3 years ago

joe-getcouragenow commented 3 years ago

Booty has the correct approach for our project such that any repo can use it and:

Booty uses make file, and make files are nice and easy but we can convert this to mage files in order to build a highly reusable build, gen and deployment tool where you get compile time errors. Mage can run as an interpreter just like make can BTW. So we DONT need to release booty. Repos just link to it in their go.mod, like with any golang code.

NOTE: We should do this work in booty repo and ensure that the CI keeps working as we develop it. Booty has an example golang proj, and booty-test repo also has an example. Booty-test ensures that dependencies are still working from booty. SO you can keep making sure things are working in boot and booty-test repo as you extend mage code.

Eventually we replace all of the makefile with golang / mage is the intent.

Here is mage: https://github.com/magefile/mage

SO in each Repo root, instead of a root makefile, you have a root magefile.go

I would start with a good base of what others have done to make mage work for them.

Here are tons of example of using mage: https://github.com/search?l=Go&o=desc&q=github.com%2Fmagefile%2Fmage&s=indexed&type=Code

Panther looks decent. https://github.com/panther-labs/panther/blob/master/magefile.go

not bad... https://github.com/trnlink/ls/blob/v3.10/tools/mage/git.go

NOTE: the main thing is to follow the approach booty takes. It took a while to work out this approach to CI that works for all our needs.

Bits to convert:

  1. In booty we have gitr.mk. We need to get that "maged"...
  2. In shared, we have the common bs-* stuff we also need installed as part of the Dep cycle. That can simple be copied to booty, and installed from there i think. This is golang
  3. In https://github.com/getcouragenow/boot/tree/master/boilerplate/tool/grpc, we have all the deps we need to install. Use the dwn.mk as the logical approach as we know this works in CI and locally. We just need to "mage it".
  4. After that its quite easy i think. We already have a good makefile approach where the CI just calls "make all", and the makefile root takes over. Soyou just need to copy this pattern with mage i think.