From 8611f3b950bfa78783d379c2628167ee888e6702 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:34:41 -0400 Subject: [PATCH 1/7] add unit test pipeline --- .github/workflows/unit-test.yml | 24 ++++++++++++++++++++++++ README.md | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) 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..24c4bc6 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,24 @@ +name: Unit Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Prepare GO env + uses: actions/setup-go@v2 + with: + go-version: '1.18' + + - 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) From 58d6b6e8706d84db0e94170720589e4157e23155 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:41:05 -0400 Subject: [PATCH 2/7] edit triggers --- .github/workflows/unit-test.yml | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 24c4bc6..d9ceef2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,24 +1,18 @@ name: Unit Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - +on: [push, pull_request] jobs: - - build: - name: Build - runs-on: ubuntu-latest + test: + strategy: + matrix: + go-version: [1.18.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Prepare GO env + - name: Install Go uses: actions/setup-go@v2 - with: - go-version: '1.18' - + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 - name: Test - run: go test -v ./... \ No newline at end of file + run: go test ./... \ No newline at end of file From e7553adca9b406ef43b29cf14821a55e6ff5bc65 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:42:24 -0400 Subject: [PATCH 3/7] change version --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d9ceef2..dadef9f 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -4,7 +4,7 @@ jobs: test: strategy: matrix: - go-version: [1.18.x] + go-version: [1.18.0-beta1] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From e7412e555c507ec83bd4a4fdc7fbb91143082503 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:43:18 -0400 Subject: [PATCH 4/7] change version --- .github/workflows/unit-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index dadef9f..841ff80 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -4,7 +4,7 @@ jobs: test: strategy: matrix: - go-version: [1.18.0-beta1] + go-version: [1.18-beta1] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From 6255a37c08096c8b30d2c7912d107c167fd55092 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:46:59 -0400 Subject: [PATCH 5/7] other try --- .github/workflows/unit-test.yml | 43 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 841ff80..e1e7253 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,18 +1,33 @@ -name: Unit Tests -on: [push, pull_request] +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + jobs: - test: - strategy: - matrix: - go-version: [1.18-beta1] - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} + + build: + name: Build + runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout code + - 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 ./... \ No newline at end of file + run: go test -v ./... \ No newline at end of file From ab6f1689b04f427978229dd219c420ee270ac8b4 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 21:47:54 -0400 Subject: [PATCH 6/7] other try --- .github/workflows/unit-test.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index e1e7253..4115a26 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,13 +1,6 @@ -name: Go - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - +name: Unit Tests +on: [ push, pull_request ] jobs: - build: name: Build runs-on: ubuntu-latest From fdc5a8ae6a1c1a4a242a2821a0858b9c22ed7f46 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 1 Jan 2022 22:21:01 -0400 Subject: [PATCH 7/7] fix: redeclared function name --- examples/chaining.go | 2 +- examples/filterMapReduce.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 })