From 786fcbc94fde6631463b683e7ee526ba4e239766 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 25 Jan 2024 03:04:02 -0500 Subject: [PATCH] Add build and test workflow --- .github/workflows/build_and_test.yml | 20 ++++++++++++++++++++ Makefile | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_and_test.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..c0922ef --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,20 @@ +name: Build and test +on: [push] + +jobs: + build_and_test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go 1.21 + uses: actions/setup-go@v4 + with: + go-version: '1.21.x' + + - name: Build binary + run: make build + + - name: Run tests + run: make testv diff --git a/Makefile b/Makefile index b09630f..c8a1d98 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,12 @@ dev: bin fmt: goimports -w . + test: - go test ./... + go test $(TEST_FLAGS) $(shell go list ./...) + +testv: TEST_FLAGS += -v +testv: test vet: go vet ./...