From 036b17751ca69f2da04ef3150b477ea795f73011 Mon Sep 17 00:00:00 2001 From: Shingo Omura Date: Thu, 18 Jun 2020 18:26:00 +0900 Subject: [PATCH 1/2] setup ci workflow --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++++++++++++++++++ Makefile | 8 ++++---- README.md | 2 ++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1fb70fb --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + types: [opened, synchronize] + +jobs: + + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: go mod download + + - name: Get Devtools + run: make setup + + - name: Lint + run : make lint + + - name: Build + run: make + + - name: Test + run: make test diff --git a/Makefile b/Makefile index b2f44a4..27d6a5d 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,10 @@ setup: npm install --prefix=.dev markdown-toc && \ npm install --prefix=.dev github-release-notes && \ cd $(shell go env GOPATH) && \ - GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports && \ - GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint && \ - GO111MODULE=off go get -u github.com/elastic/go-licenser && \ - GO111MODULE=off go get -u github.com/tcnksm/ghr + go get -u golang.org/x/tools/cmd/goimports && \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.27.0 && \ + go get -u github.com/elastic/go-licenser && \ + go get -u github.com/tcnksm/ghr .PHONY: fmt fmt: diff --git a/README.md b/README.md index 9864bad..9602427 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # pftaskqueue: Lightweight task queue tool. Feel free to process embarrassingly-parallel tasks at scale. +[![CI](https://github.com/pfnet-research/pftaskqueue/workflows/CI/badge.svg)](https://github.com/pfnet-research/pftaskqueue/actions?query=workflow%3ACI) + ``` +-------------------------+ +----+ +----+ +----+ +----+ From d116bfb14cababdf58df4f7bbf79c2b927c8d6a0 Mon Sep 17 00:00:00 2001 From: Shingo Omura Date: Thu, 18 Jun 2020 18:41:34 +0900 Subject: [PATCH 2/2] it should "bash" in worker test because "sh" in Ubuntu is actually "dash" --- pkg/worker/worker_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/worker/worker_test.go b/pkg/worker/worker_test.go index ea13b41..73341c0 100644 --- a/pkg/worker/worker_test.go +++ b/pkg/worker/worker_test.go @@ -90,7 +90,7 @@ var _ = Describe("Worker", func() { TaskHandler: apiworker.TaskHandlerSpec{ DefaultCommandTimeout: 1 * time.Minute, Commands: []string{ - "sh", + "bash", "-c", heredoc.Doc(` DIR=$(cat)