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",
|
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() {
|
2018-03-28 22:26:19 +00:00
|
|
|
defer color.Green("Finished.")
|
|
|
|
|
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")
|
2018-02-27 12:29:47 +00:00
|
|
|
admin.SendNotification(&arn.PushNotification{
|
2017-10-02 09:22:17 +00:00
|
|
|
Title: pkg,
|
|
|
|
Message: "Test failed",
|
|
|
|
Link: "https://" + pkg,
|
2018-06-30 05:03:07 +00:00
|
|
|
Icon: "https://media.notify.moe/images/brand/220.png",
|
2018-02-28 10:30:47 +00:00
|
|
|
Type: arn.NotificationTypePackageTest,
|
2017-10-02 09:22:17 +00:00
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("%s", pkg)
|
2017-10-02 06:46:10 +00:00
|
|
|
}
|