From c498d230d686ffa1bebd431c9e859b61cba23aa9 Mon Sep 17 00:00:00 2001 From: Morgan Bauer Date: Sun, 28 Jul 2019 21:11:08 -0700 Subject: [PATCH] golang hello world - with test - with github actions CI Signed-off-by: Morgan Bauer --- .github/workflows/go.yml | 34 ++++++++++++++++++++++++++++++++++ .travis.yml | 0 main.go | 11 +++++++++++ main_test.go | 13 +++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 .github/workflows/go.yml delete mode 100644 .travis.yml create mode 100644 main.go create mode 100644 main_test.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..b66c0d7 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + 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 get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: Build + run: go build -v . diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e69de29..0000000 diff --git a/main.go b/main.go new file mode 100644 index 0000000..0b47842 --- /dev/null +++ b/main.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func main() { + fmt.Println(Greet()) +} + +func Greet() string { + return "Hello, World!" +} diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..58ef71b --- /dev/null +++ b/main_test.go @@ -0,0 +1,13 @@ +package main_test + +import ( + "testing" + + main "." +) + +func TestGreet(t *testing.T) { + if main.Greet() != "Hello, World!" { + t.Fail() + } +}