From 82931d1fabe8b254b28946ff690595d43e23625b 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..f26ea23 --- /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 bin + + - 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 ./...