From 2d05b6c5189eda8f6a75bb7f57043131b381d1e2 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 22:28:12 -0400 Subject: [PATCH] add unit test pipeline (#8) * add unit test pipeline * edit triggers * change version * change version * other try * other try * fix: redeclared function name Co-authored-by: Ruidy --- .github/workflows/unit-test.yml | 26 ++++++++++++++++++++++++++ README.md | 1 - examples/chaining.go | 2 +- examples/filterMapReduce.go | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..4115a26 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,26 @@ +name: Unit Tests +on: [ push, pull_request ] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Install gotip + run: | + git clone --depth=1 https://go.googlesource.com/go $HOME/gotip + cd $HOME/gotip/src + ./make.bash + echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV + echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + - name: Test + run: go test -v ./... \ No newline at end of file diff --git a/README.md b/README.md index 404626b..d763372 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ ![License](https://img.shields.io/github/license/rjNemo/underscore?style=for-the-badge) ![Go version](https://img.shields.io/github/go-mod/go-version/rjNemo/underscore?style=for-the-badge) - ![test coverage](https://img.shields.io/badge/Test%20Coverage-100%25-brightgreen.svg?longCache=true&style=for-the-badge) ![underscore](https://socialify.git.ci/rjNemo/underscore/image?description=1&font=Raleway&language=1&logo=https%3A%2F%2Fgithub.com%2FrjNemo%2Funderscore%2Fblob%2Fmain%2Fdocs%2Fstatic%2Flogo.png%3Fraw%3Dtrue&name=1&pattern=Floating%20Cogs&theme=Light) diff --git a/examples/chaining.go b/examples/chaining.go index a62d1d1..f0c04cc 100644 --- a/examples/chaining.go +++ b/examples/chaining.go @@ -6,7 +6,7 @@ import ( u "github.com/rjNemo/underscore" ) -func main() { +func chaining() { sum := u.NewChain([]int{1, 2, 3, 4, 5, 6, 7, 8, 9}). // filter even numbers from the slice Filter(func(n int) bool { return n%2 == 0 }). diff --git a/examples/filterMapReduce.go b/examples/filterMapReduce.go index a1c5fe1..d0d1b64 100644 --- a/examples/filterMapReduce.go +++ b/examples/filterMapReduce.go @@ -6,7 +6,7 @@ import ( u "github.com/rjNemo/underscore" ) -func main() { +func filterMapReduce() { numbers := []int{1, 2, 3, 4, 5, 6, 7, 8, 9} // filter even numbers from the slice evens := u.Filter(numbers, func(n int) bool { return n%2 == 0 })