-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.go
43 lines (31 loc) · 1.21 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"github.com/bitrise-io/go-steputils/stepconf"
"github.com/bitrise-io/go-utils/log"
)
type config struct {
AdditionalParams string `env:"additional_params"`
TestsPathPattern string `env:"tests_path_pattern"`
ProjectLocation string `env:"project_location,dir"`
TestResultsDir string `env:"bitrise_test_result_dir,dir"`
GenerateCodeCoverageFiles bool `env:"generate_code_coverage_files,opt[yes,no]"`
}
var ir interrupt = realInterrupt{}
var parser configParser = realConfigParser{interrupt: ir}
var builder commandBuilder = realCommandBuilder{interrupt: ir}
var test testExecutor = realTestExecutor{interrupt: ir, commandBuilder: builder, testExporter: realTestExporter{interrupt: ir}}
func main() {
cfg := parser.parseConfig()
stepconf.Print(cfg)
additionalParams := parser.parseAdditionalParams(cfg.AdditionalParams)
testPaths := parser.expandTestsPathPattern(cfg.ProjectLocation, cfg.TestsPathPattern)
additionalParams = append(additionalParams, testPaths...)
fmt.Println()
log.Infof("Running test")
outputBuffer, testErr := test.executeTest(cfg, additionalParams)
test.exportTestResults(cfg, outputBuffer)
if testErr {
ir.fail()
}
}