From 86c710c4fe6d0c2cc273e3a57c7c2375c6949b6e Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Sat, 31 Oct 2020 01:12:08 +0800 Subject: [PATCH] Add Action --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ Makefile | 6 ++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5e8d525 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Go + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Set Git user + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Format code + run: go fmt + + - name: Commit and push changes + id: commit-dockerfiles + run: | + git add . + if output=$(git status --porcelain) && [ ! -z "$output" ]; then + git commit -m "[Action] go fmt" -a + git push + fi + + - name: Build + run: make + + - name: Test + run: make test diff --git a/Makefile b/Makefile index bcc1f67..7a58c7d 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,11 @@ clean: build: datetime datetime: *.go - $(GO) build -o datetime + $(GO) build -v -o datetime + +.PHONY: test +test: + $(GO) test -v DATASETS = \