magefile.go 754 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package main
  2. import (
  3. "runtime"
  4. "strconv"
  5. "github.com/magefile/mage/sh"
  6. )
  7. var (
  8. Default = Build
  9. )
  10. // Generate generates mock implementations of interfaces.
  11. func Generate() (err error) {
  12. return sh.RunV("go", "tool", "cmg", "gen", "./...")
  13. }
  14. // Build builds the binaries.
  15. func Build() error {
  16. return sh.RunV("go", "build", "./cmd/presence")
  17. }
  18. // Lint runs the lint suite.
  19. func Lint() error {
  20. return sh.RunV("golangci-lint", "run", "./...")
  21. }
  22. // Test runs the test suite.
  23. func Test() error {
  24. return sh.RunV("go", "test", "-cover", "-race", "./...")
  25. }
  26. // Snapshot runs the release snapshot.
  27. func Snapshot() error {
  28. nc := runtime.NumCPU()
  29. return sh.RunV("goreleaser", "release", "--clean", "--parallelism", strconv.Itoa(nc), "--snapshot")
  30. }