Skip to content

Commit

Permalink
fix: removed concurrency from ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldack committed Oct 19, 2023
1 parent 7658366 commit d38f4d3
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,25 @@ func main() {
}
defer ci.client.Close()

errs := make(chan error, 3)
done := make(chan struct{})

go func() {
errs <- ci.build(ctx)
done <- struct{}{}
}()

go func() {
errs <- ci.test(ctx)
done <- struct{}{}
}()

go func() {
errs <- ci.lint(ctx)
done <- struct{}{}
}()

counter := 0
for {
select {
case err := <-errs:
if err != nil {
slog.Error("an error occurred", "error", err)
}
case <-done:
counter++
if counter == 3 {
os.Exit(0)
}
}
err = ci.build(ctx)
if err != nil {
slog.Error("an error occurred", "error", err)
os.Exit(1)
}

err = ci.lint(ctx)
if err != nil {
slog.Error("an error occurred", "error", err)
os.Exit(1)
}

err = ci.test(ctx)
if err != nil {
slog.Error("an error occurred", "error", err)
os.Exit(1)
}

slog.Info("CI passed")
}

func NewCI(ctx context.Context) (*CI, error) {
Expand Down

0 comments on commit d38f4d3

Please sign in to comment.