File tree Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Validate PRs
2
+
3
+ on :
4
+ pull_request :
5
+ branches : [ master ]
6
+
7
+ jobs :
8
+ go :
9
+ name : Check go sources
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ -
13
+ name : Set up Go 1.x
14
+ uses : actions/setup-go@v2
15
+ with :
16
+ go-version : ^1.12
17
+ -
18
+ name : Check out code into the Go module directory
19
+ uses : actions/checkout@v2
20
+ -
21
+ name : Cache go modules
22
+ id : cache-mod
23
+ uses : actions/cache@v2
24
+ with :
25
+ path : ~/go/pkg/mod
26
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27
+ restore-keys : |
28
+ ${{ runner.os }}-go-
29
+ -
30
+ name : Download dependencies
31
+ run : go mod download
32
+ if : steps.cache-mod.outputs.cache-hit != 'true'
33
+ -
34
+ name : Check go mod status
35
+ run : |
36
+ go mod tidy
37
+ if [[ ! -z $(git status -s) ]]
38
+ then
39
+ echo "Go mod state is not clean"
40
+ exit 1
41
+ fi
42
+ -
43
+ name : Check format
44
+ run : |
45
+ go get -u github.com/google/addlicense
46
+ git reset HEAD --hard
47
+
48
+ make fmt
49
+ make fmt_license
50
+ if [[ ! -z $(git status -s) ]]
51
+ then
52
+ echo "not well formatted sources are found"
53
+ exit 1
54
+ fi
55
+ -
56
+ name : Run Go Tests
57
+ run : make test
58
+
59
+ docker :
60
+ name : Check docker build
61
+ runs-on : ubuntu-latest
62
+ steps :
63
+ -
64
+ name : Check out code into the Go module directory
65
+ uses : actions/checkout@v2
66
+ -
67
+ name : Check if dockerimage build is working
68
+ run : docker build -f ./build/Dockerfile .
Original file line number Diff line number Diff line change @@ -259,6 +259,11 @@ start_local:
259
259
start_local_debug :
260
260
operator-sdk run --local --watch-namespace $(NAMESPACE ) --enable-delve 2>&1 | grep --color=always -E ' "msg":"[^"]*"|$$'
261
261
262
+ .PHONY : test
263
+ # ## test: run unit tests
264
+ test :
265
+ go test $(shell go list ./... | grep -v test/e2e)
266
+
262
267
# ## test_e2e: runs e2e test on the cluster set in context. Includes deploying devworkspace-controller, run test workspace, uninstall devworkspace-controller
263
268
test_e2e : _print_vars _set_ctx _update_yamls update_devworkspace_crds _do_e2e_test _reset_yamls _reset_ctx
264
269
You can’t perform that action at this time.
0 commit comments