Tonkpils / snag

Automatic build tool for all your projects
MIT License
32 stars 4 forks source link

Adding parallel runners #50

Closed zabawaba99 closed 8 years ago

zabawaba99 commented 8 years ago

Closes #48

The snag.yml now accepts a 'Runners' tag. This tag represents a group of commands that are meant to be run in parallel after the build stage.

Each process will be given a chance to start and will then get backgrounded to allow other processes to run. The output of each command is streamed to stdout prefix with the pid of the logging command

Tonkpils commented 8 years ago

We'll need to update the documentation but if you'd like I'll do that after we merge this

zabawaba99 commented 8 years ago

I also wanted to add some tests to it. What do you think about the overall implementation?

Tonkpils commented 8 years ago

I also wanted to add some tests to it. What do you think about the overall implementation?

Looks good, nothing that jumps out at me. I'm going to clone it and test out it a bit.

zabawaba99 commented 8 years ago

Did some manual testing and it looks good on my end. Going to start unit testing between tonight and tomorrow morning and push a new commit.

screen shot 2016-01-25 at 9 16 23 pm
zabawaba99 commented 8 years ago

Latests changes:

.snag.yml

verbose: true

ignore:
  - .git
  - snag
  - snag.exe

build:
  - go build
  - go vet
  - gofmt -l -s .
  - go test . ./vow -test.short

run:
  - go run test/binary1/main.go
  - go run test/binary2/main.go
  - go run test/binary3/main.go

test/binary1/main.go

package main

import (
    "fmt"
    "time"
)

func main() {
    for i := 0; i < 10; i++ {
        fmt.Printf("Sleep count %d\n", i)
        time.Sleep(time.Second)
    }
}

test/binary2/main.go

package main

import (
    "fmt"
    "os"
    "time"
)

func main() {
    for i := 8; i > 0; i-- {
        fmt.Printf("Failing in %d\n", i)
        time.Sleep(time.Second)
    }

    os.Exit(1)
}

test/binary3/main.go

package main

import (
    "fmt"
    "time"
)

func main() {
    var count int
    for range time.Tick(5 * time.Second) {
        count++
        fmt.Printf("Ticked count %d\n", count)
    }
}

Result: ezgif com-video-to-gif

Tonkpils commented 8 years ago

Looks good, I'm going to merge this and we can iterate over it on master