From 69652c04b8e4e52754154dc0b9dd883bc7337171 Mon Sep 17 00:00:00 2001 From: Volodkin Vladislav Date: Fri, 13 Oct 2023 10:58:04 +0100 Subject: [PATCH] Add tests action (#10) Run tests for PR updates --- .github/workflows/unit-tests.yaml | 28 ++++++++++++++++++++++++++++ Makefile | 8 ++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/unit-tests.yaml diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml new file mode 100644 index 0000000..b8347ee --- /dev/null +++ b/.github/workflows/unit-tests.yaml @@ -0,0 +1,28 @@ +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + + - name: Check style + run: make check_style + + - name: Build + run: make bin + + - name: Test + run: go test -v -race ./pkg/... diff --git a/Makefile b/Makefile index f85ac98..055cad6 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,14 @@ test: go test -v -race ./pkg/... go test -v ./tests/sanity/... +.PHONY: fmt +fmt: + go fmt ./... + +.PHONY: check_style +check_style: + test -z "$$(gofmt -d . | tee /dev/stderr)" + .PHONY: clean clean: rm -rf bin/ && docker system prune