spirit-labs / tektite

Tektite DB
http://www.tektitedb.com
Other
167 stars 25 forks source link

Using mage as a task runner #113

Closed devguyio closed 3 months ago

devguyio commented 3 months ago

Summary

Create a magefile with the following targets

  1. Build
  2. Lint
  3. Test: Only run unit tests (i.e. without the integration build flag)
  4. Integration: Run integration tests (with the integration build flag)
  5. Loop: Run tests in a continuous loop
  6. Run: Run tektited in a standalone setup
  7. LicenseCheck: Runs the following command to fix any missing license header in the source code
     addlicense -c 'The Tektite Authors' -ignore '**/*.yml' -ignore '**/*.xml' .
  8. PreSubmit: This is intended to be run by contributors before pushing the code and creating a PR. It depends on the following targets in order:
    1. LicenseCheck
    2. Build
    3. Lint
    4. Test
    5. Integration

Consider adding a target for installing missing development tooling such as gotestsum etc. Check out this checkTools function .

[!Note] This issue started in the below GitHub Discussion and was confirmed on slack

Discussed in https://github.com/spirit-labs/tektite/discussions/72

Originally posted by **devguyio** May 29, 2024 I've been a big fan of using [mage](https://magefile.org/) instead of mage specially for go code due to - Instead of the tons of shell scripts that Make typically enforces you to do, you write clean, testable, statically typed automation code. - You can easily use any test packages that were developed for tests directly in the mage file. - Mage also a couple of [helper libraries ](https://magefile.org/libraries/) that make executing shell commands from Go code very easy. - Many communities are starting to adopt it like Hugo and Kubernetes [SIG Release](https://github.com/kubernetes-sigs/release-sdk/blob/main/magefile.go) Here's a mage file that I created for my toy project https://github.com/kcore-io/kcore/blob/main/magefile.go I also used the nice [lipgloss](https://github.com/charmbracelet/lipgloss) package to end up with some output like this as I believe in having a clear and observable developer experience to reduce human errors. [![asciicast](https://asciinema.org/a/sxC6JPR5bb1AOZpfdMZ94GAJX.svg)](https://asciinema.org/a/sxC6JPR5bb1AOZpfdMZ94GAJX)
vchandela commented 3 months ago

@devguyio can I take this up?

vchandela commented 3 months ago

Loop: Run tests in a continuous loop

purplefox commented 3 months ago

Could you please explain what you mean by continuous loop?

There's currently a script called run_tests_in_loop.sh which runs tests in a loop. I think the idea is to convert this to a mage target.

vchandela commented 3 months ago

Run: Run tektited in a standalone setup

devguyio commented 3 months ago

Run: Run tektited in a standalone setup

  • In kcore, I can see an Infra() that uses kind and helm to achieve this.
  • Please share details on how we want to write an Infra() for tektited

I don't think that's needed here for now. So don't worry about infra now.

vchandela commented 3 months ago

Run: Run tektited in a standalone setup

  • In kcore, I can see an Infra() that uses kind and helm to achieve this.
  • Please share details on how we want to write an Infra() for tektited

I don't think that's needed here for now. So don't worry about infra now.

Can you please share the commands/steps for "Run tektiked in a standalone setup"?