Skip to content

Commit 27112e4

Browse files
committed
Update Makefile to add run unit test command and integrate into GH action
Signed-off-by: Shubham Bhardwaj <[email protected]>
1 parent 8d2a624 commit 27112e4

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.github/workflows/go.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,29 @@ jobs:
6464
run: |
6565
make build
6666
67+
test:
68+
name: Test
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Set up Go
72+
uses: actions/setup-go@v5
73+
with:
74+
go-version: '1.22'
75+
76+
- uses: actions/cache@v4
77+
with:
78+
path: |
79+
~/.cache/go-build
80+
~/.cache/pip
81+
~/go/pkg/mod
82+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
83+
restore-keys: |
84+
${{ runner.os }}-go-
85+
86+
- name: Check out code
87+
uses: actions/checkout@v4
88+
89+
- name: Run unit tests
90+
run: |
91+
make test
92+

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ lint-go: ## runs go linter on all go files
5252
--max-same-issues=0 \
5353
--timeout 10m
5454

55-
.PHONY: generate version-file version-updates updates build all vendor tidy lint-go mkbin
55+
test: ## runs unit tests
56+
@echo "Running unit tests..."
57+
@$(GO) test -v -mod=vendor ./...
58+
59+
.PHONY: generate version-file version-updates updates build all vendor tidy lint-go test mkbin
5660

5761
.PHONY: help
5862
help: ## print this help

0 commit comments

Comments
 (0)