2017-10-02 06:46:10 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
2017-10-02 09:22:17 +00:00
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
|
|
|
|
"github.com/fatih/color"
|
2017-10-02 06:46:10 +00:00
|
|
|
)
|
|
|
|
|
2017-10-02 09:22:17 +00:00
|
|
|
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",
|
2017-11-01 08:45:14 +00:00
|
|
|
// "github.com/animenotifier/japanese",
|
2017-10-02 09:22:17 +00:00
|
|
|
// "github.com/animenotifier/osu",
|
|
|
|
}
|
|
|
|
|
2017-10-02 06:46:10 +00:00
|
|
|
func main() {
|
2017-10-02 09:22:17 +00:00
|
|
|
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
|
2017-10-02 06:46:10 +00:00
|
|
|
|
|
|
|
err := cmd.Start()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2017-10-02 09:22:17 +00:00
|
|
|
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,
|
2017-11-04 21:23:07 +00:00
|
|
|
Icon: "https://notify.moe/images/brand/220.png",
|
2017-10-02 09:22:17 +00:00
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("%s", pkg)
|
2017-10-02 06:46:10 +00:00
|
|
|
}
|