magefile.go 721 B

1234567891011121314151617181920212223242526272829303132
  1. package main
  2. import (
  3. "github.com/magefile/mage/sh"
  4. )
  5. var (
  6. Default = Build // nolint: deadcode
  7. packagesToMock = []string{"ifttt", "neighbors", "wrap"}
  8. )
  9. // Generate generates mock implementations of interfaces.
  10. func Generate() (err error) { // nolint: deadcode
  11. for _, pkg := range packagesToMock {
  12. err = sh.Run("mockery", "--all", "--case=underscore", "--dir="+pkg, "--exported=false", "--output="+pkg+"/mocks")
  13. if err != nil {
  14. return
  15. }
  16. }
  17. return
  18. }
  19. // Build builds the binaries.
  20. func Build() error { // nolint: deadcode
  21. return sh.RunV("go", "build", "./cmd/presence")
  22. }
  23. // Test runs the test suite.
  24. func Test() error { // nolint: deadcode
  25. return sh.RunV("go", "test", "-cover", "-race", "./...")
  26. }