add sources, add visx to release flow
All checks were successful
Release / Build & publish (push) Successful in 1m26s
All checks were successful
Release / Build & publish (push) Successful in 1m26s
This commit is contained in:
@@ -119,9 +119,48 @@ func (r *Runner) buildCommand() string {
|
||||
return "go build -o solution ."
|
||||
}
|
||||
|
||||
func (r *Runner) findSources() (string, error) {
|
||||
if r.file.Sources == "" {
|
||||
return "", nil
|
||||
}
|
||||
var files []string
|
||||
err := filepath.Walk(r.cfg.WorkDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
if info.Name() == ".git" || info.Name() == ".gitea" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
matched, _ := filepath.Match(r.file.Sources, info.Name())
|
||||
if matched {
|
||||
rel, _ := filepath.Rel(r.cfg.WorkDir, path)
|
||||
files = append(files, filepath.ToSlash(rel))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("source discovery: %w", err)
|
||||
}
|
||||
if len(files) == 0 {
|
||||
return "", fmt.Errorf("no files matching %q found", r.file.Sources)
|
||||
}
|
||||
return strings.Join(files, " "), nil
|
||||
}
|
||||
|
||||
func (r *Runner) build() (string, error) {
|
||||
buildCmd := r.buildCommand()
|
||||
|
||||
sources, err := r.findSources()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if sources != "" {
|
||||
buildCmd = strings.ReplaceAll(buildCmd, "$SOURCES", sources)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
if r.file.Timeout > 0 {
|
||||
var cancel context.CancelFunc
|
||||
|
||||
Reference in New Issue
Block a user