diff --git a/.github/workflows/golang_test.yml b/.github/workflows/golang_test.yml index f3d4fa9..93356be 100644 --- a/.github/workflows/golang_test.yml +++ b/.github/workflows/golang_test.yml @@ -17,4 +17,6 @@ jobs: with: go-version: '^1.18' - 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"