2017-11-04 22:23:07 +01:00

69 lines
1.2 KiB
Go

package main
import (
"os/exec"
"sync"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
var packages = []string{
"github.com/animenotifier/notify.moe",
"github.com/animenotifier/arn",
"github.com/animenotifier/kitsu",
"github.com/animenotifier/anilist",
"github.com/animenotifier/mal",
"github.com/animenotifier/shoboi",
"github.com/animenotifier/twist",
"github.com/animenotifier/avatar",
// "github.com/animenotifier/japanese",
// "github.com/animenotifier/osu",
}
func main() {
wg := sync.WaitGroup{}
for _, pkg := range packages {
wg.Add(1)
go func(pkgLocal string) {
testPackage(pkgLocal)
wg.Done()
}(pkg)
}
wg.Wait()
}
func testPackage(pkg string) {
cmd := exec.Command("go", "test", pkg+"/...")
// cmd.Stdout = os.Stdout
// cmd.Stderr = os.Stderr
err := cmd.Start()
if err != nil {
panic(err)
}
err = cmd.Wait()
if err != nil {
color.Red("%s", pkg)
// Send notification to the admin
admin, _ := arn.GetUser("4J6qpK1ve")
admin.SendNotification(&arn.Notification{
Title: pkg,
Message: "Test failed",
Link: "https://" + pkg,
Icon: "https://notify.moe/images/brand/220.png",
})
return
}
color.Green("%s", pkg)
}