From 22bf6ae45ecbbaa89881104fd74edacf4c1f650e Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 16:38:15 -0700 Subject: [PATCH 1/6] Adding pipeline for PRs. --- .github/workflows/config.yml | 17 +++++++++++++++++ Makefile | 2 +- go.mod | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/config.yml diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 000000000..526850922 --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,17 @@ +on: + push: + branches: + - 158-run-tests-github-actions + pull_request: + branches: + - master + +jobs: + unit_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run Go Tests + uses: docker://golang:1.12 + run: | + make check \ No newline at end of file diff --git a/Makefile b/Makefile index 812cb702c..83014e09d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PKG ?=github.com/commitdev/zero BUILD_ARGS=-v -ldflags=all="-X ${PKG}/cmd.appVersion=${VERSION} -X ${PKG}/cmd.appBuild=${BUILD}" check: - go test ./... + go test -v $(go list -f '{{.Dir}}' ./... | grep -v /tmp/) fmt: go fmt ./... diff --git a/go.mod b/go.mod index 6940f00b3..d89cfb6c8 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect github.com/coreos/go-semver v0.2.0 + github.com/google/go-cmp v0.3.0 github.com/google/uuid v1.1.1 github.com/gorilla/handlers v1.4.2 github.com/gorilla/mux v1.7.3 From 69c1f7ee80b1b4987e42e255cfaf4af7bac39b55 Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 17:11:32 -0700 Subject: [PATCH 2/6] Using Golang action. --- .github/workflows/config.yml | 10 ++++++---- Makefile | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 526850922..3f78c965c 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -1,7 +1,6 @@ + + on: - push: - branches: - - 158-run-tests-github-actions pull_request: branches: - master @@ -11,7 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.12 - name: Run Go Tests - uses: docker://golang:1.12 run: | + make deps make check \ No newline at end of file diff --git a/Makefile b/Makefile index 83014e09d..04efdcc38 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ BUILD ?=$(shell git rev-parse --short HEAD) PKG ?=github.com/commitdev/zero BUILD_ARGS=-v -ldflags=all="-X ${PKG}/cmd.appVersion=${VERSION} -X ${PKG}/cmd.appBuild=${BUILD}" +deps: + go mod download + check: go test -v $(go list -f '{{.Dir}}' ./... | grep -v /tmp/) From 091f60ee4212e64138ba32a4f07c833c8bea4511 Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 17:14:27 -0700 Subject: [PATCH 3/6] Testing. --- .github/workflows/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 3f78c965c..74154b6de 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -1,6 +1,7 @@ - - on: + push: + branches: + - 158-run-tests-github-actions pull_request: branches: - master From c0013370c80ad995268dec1a0613e3237e0dd913 Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 17:22:47 -0700 Subject: [PATCH 4/6] Updated test command. --- .github/workflows/config.yml | 4 +++- Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 74154b6de..a3291ee1f 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -14,7 +14,9 @@ jobs: - uses: actions/setup-go@v2 with: go-version: 1.12 - - name: Run Go Tests + - name: Download Go Packages run: | make deps + - name: Run Go Tests + run: | make check \ No newline at end of file diff --git a/Makefile b/Makefile index 04efdcc38..75785783c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ deps: go mod download check: - go test -v $(go list -f '{{.Dir}}' ./... | grep -v /tmp/) + go list -f '{{.Dir}}' ./... | grep -v /tmp/ | xargs go test -v fmt: go fmt ./... From 0f047432ef0a96d3e07188569b647d9938ec3a54 Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 17:25:52 -0700 Subject: [PATCH 5/6] Removed testing code. --- .github/workflows/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index a3291ee1f..ec3a89344 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -1,7 +1,4 @@ on: - push: - branches: - - 158-run-tests-github-actions pull_request: branches: - master From 6e302ed9222b3e930d34ac9bb9debf96c05f2d81 Mon Sep 17 00:00:00 2001 From: Direside Date: Thu, 11 Jun 2020 17:27:58 -0700 Subject: [PATCH 6/6] Added newline at end of pipeline file, because Github wants it. It doesn't need it, it just wants it bad enough to show an icon in your PRs. --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index ec3a89344..77cd68629 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -16,4 +16,4 @@ jobs: make deps - name: Run Go Tests run: | - make check \ No newline at end of file + make check