diff --git a/.github/workflows/pullrequests.yaml b/.github/workflows/pullrequests.yaml new file mode 100644 index 0000000..b39255e --- /dev/null +++ b/.github/workflows/pullrequests.yaml @@ -0,0 +1,17 @@ +name: Tests +on: [pull_request] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 'stable' + + - name: Go Tests + run: go test -v ./... diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d1ed3c3 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,28 @@ +name: release +on: + push: + branches: + - main + +jobs: + release: + name: Build and Release + runs-on: [ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Release Version + id: version + run: | + export RELEASE_VERSION=v0.0.${{ github.run_number }} + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT + + - name: create tag + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git tag -a $RELEASE_VERSION -m $RELEASE_VERSION + git push origin $RELEASE_VERSION + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 556fdd4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - 1.10.x - - tip - -before_install: - - go get github.com/golang/lint/golint - -before_script: - - go vet ./... - - golint -set_exit_status ./... - -script: - - go test -v ./... diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..cfd6dd3 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module github.com/jasonhancock/multiplex + +go 1.21.3 + +require github.com/stretchr/testify v1.8.4 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..fa4b6e6 --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/plexer_test.go b/plexer_test.go index 73a0933..4ca4b43 100644 --- a/plexer_test.go +++ b/plexer_test.go @@ -7,12 +7,10 @@ import ( "testing" "time" - "github.com/cheekybits/is" + "github.com/stretchr/testify/require" ) func TestPlexer(t *testing.T) { - is := is.New(t) - var chans []chan []byte for i := 0; i < 10; i++ { chans = append(chans, make(chan []byte, 1000)) @@ -50,14 +48,12 @@ func TestPlexer(t *testing.T) { mod++ } val, err := strconv.Atoi(string(values[i])) - is.NoErr(err) - is.True(val%10 == mod) + require.NoError(t, err) + require.True(t, val%10 == mod) } } func TestPlexerCloseChan(t *testing.T) { - is := is.New(t) - var chans []chan []byte for i := 0; i < 10; i++ { @@ -94,8 +90,8 @@ func TestPlexerCloseChan(t *testing.T) { } wg.Wait() - is.Equal(values[0], []byte("foo")) - is.Equal(values[1], []byte("bar")) + require.Equal(t, []byte("foo"), values[0]) + require.Equal(t, []byte("bar"), values[1]) } func chConv(channels ...chan []byte) []<-chan []byte {