Exemple #1
0
func main() {
	defer glog.Flush()
	flag.Set("logtostderr", "true")
	flag.Set("v", "2")
	flag.Parse()

	// Add actions sources
	for _, source := range strings.Split(sources, ",") {
		core.Source(source)
	}

	// Executor
	ex := executor.New(tests)

	// API
	http.Handle("/watch", api.WatchHandler{Executor: ex})
	http.Handle("/execute", api.ExecuteHandler{Executor: ex})
	http.Handle("/status/poll", api.PollHandler{Executor: ex})
	http.Handle("/status", api.StatusHandler{Executor: ex})
	http.Handle("/latest", api.LatestHandler{Executor: ex})

	// Dashboard
	http.Handle("/", http.FileServer(http.Dir(dashboard)))

	if watch {
		go ex.Watch()
	}

	// Start listening
	glog.Infof("Listening on address %s\n", listenaddr)
	glog.Fatal(http.ListenAndServe(listenaddr, nil))
}
Exemple #2
0
func main() {
	// Parse flags and print Usage if `-tests` flag is empty.
	parseFlags()

	// Load tests from file
	tests, err := testutils.ReadTests(dirname)
	if err != nil {
		l.Fatal(err)
	}

	// Print error when no tests
	if len(tests) == 0 {
		fmt.Printf("--- FAIL no tests")
		return
	}

	// Add actions sources
	for _, source := range strings.Split(sources, ",") {
		core.Source(source)
	}

	// Run tests
	results := tests.Run()

	// Print results
	results.Print()
}
Exemple #3
0
// creates a registry using environment variables
//   ACTIONS_SOURCES - list of actions sources (comma separated)
func init() {
	for _, source := range strings.Split(os.Getenv("ACTIONS_SOURCES"), ",") {
		if source == "" {
			continue
		}
		core.Source(source)
	}
}
Exemple #4
0
// BindSources - Binds command actions sources.
func (cmd *Command) BindSources() {
	for _, source := range cmd.Sources {
		core.Source(source)
	}
}