From c6beac17affde9ed91a12a4873d03d6ab61985b3 Mon Sep 17 00:00:00 2001 From: slowy07 Date: Mon, 7 Jul 2025 15:30:12 +0700 Subject: [PATCH] chore: menambahkan makefile tujuannya agar menjalankan kode dari github action langsung dengan perintah dari makefile Signed-off-by: slowy07 --- .github/workflows/golang_test.yml | 6 +++++- Makefile | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.github/workflows/golang_test.yml b/.github/workflows/golang_test.yml index 70b1564..739523c 100644 --- a/.github/workflows/golang_test.yml +++ b/.github/workflows/golang_test.yml @@ -22,5 +22,9 @@ jobs: version: v1.51.0 args: --disable-all -E gofmt --print-linter-name skip-build-cache: true + - name: format kode + run: make format - name: run unit testing - run: go test $(go list ./... | grep -v 'basic\|intermediate\|utilities') + run: make test + - name: unittesting dengan race-condition + run: make test-race diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c05f9ff --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +EXCLUDE_FOLDER = "basic\|intermediate\|utilities" +TEST_PACKAGE := $(shell go list ./... | grep -v $(EXCLUDE_FOLDER)) + +.DEFAULT_GOAL := test + +test: + @echo "testing file golang" + go test -v $(TEST_PACKAGE) + +test-race: + @echo "testing dengan race detector" + go test -race -v $(TEST_PACKAGE) + +format: + @echo "format kode" + go fmt ./... + +help: + @echo "command param tersedia" + @echo " make test - jalankan unittesting" + @echo " make test-race - jalankan testing dengan race detector" + @echo " format - format kode"