File tree Expand file tree Collapse file tree 4 files changed +6
-24
lines changed Expand file tree Collapse file tree 4 files changed +6
-24
lines changed Original file line number Diff line number Diff line change 99
99
- name : Run tests
100
100
env :
101
101
GO_MODULE_PATH : ${{ matrix.module.path }}
102
- # run: task go:test ## TODO: refactor the tests
103
- run : task go:test:docker
102
+ run : task go:test
104
103
105
104
- name : Send unit tests coverage to Codecov
106
105
if : runner.os == 'Linux'
Original file line number Diff line number Diff line change 1
-
2
1
version : " 3"
3
2
4
3
vars :
11
10
go list ./... | tr '\n' ' ' ||
12
11
echo '"ERROR: Unable to discover Go packages"'
13
12
)
14
- # `-ldflags` flag to use for `go build` command
15
- # TODO: define flag if required by the project, or leave empty if not needed.
16
- LDFLAGS :
17
13
18
14
tasks :
19
15
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
@@ -47,19 +43,6 @@ tasks:
47
43
go:test :
48
44
desc : Run unit tests
49
45
dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
50
- cmds :
51
- - |
52
- go test \
53
- -v \
54
- -short \
55
- -run '{{default ".*" .GO_TEST_REGEX}}' \
56
- {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
57
- -coverprofile=coverage_unit.txt \
58
- {{.TEST_LDFLAGS}} \
59
- {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
60
-
61
- go:test:docker :
62
- desc : Run the tests inside a docker image
63
46
cmds :
64
47
- docker build -f testdata/Dockerfile -t go-apt-test:latest .
65
- - docker run --rm go-apt-test
48
+ - docker run --rm -v "$PWD":/app go-apt-test -v -short -run '{{default ".*" .GO_TEST_REGEX}}' {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ func TestCheckForUpdates(t *testing.T) {
71
71
}
72
72
73
73
func TestParseListUpgradableOutput (t * testing.T ) {
74
- t .Run ("special cases" , func (t * testing.T ) {
74
+ t .Run ("edges cases" , func (t * testing.T ) {
75
75
tests := []struct {
76
76
name string
77
77
input string
@@ -84,7 +84,7 @@ func TestParseListUpgradableOutput(t *testing.T) {
84
84
},
85
85
{
86
86
name : "line not matching regex" ,
87
- input : "this-is-not- a-valid-line\n " ,
87
+ input : "this-is-not a-valid-line\n " ,
88
88
expected : []* Package {},
89
89
},
90
90
{
Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ RUN apt-get update && apt-get install -y \
10
10
WORKDIR /app
11
11
12
12
# Copy everything (mod files + code)
13
- COPY . .
13
+ COPY go.mod go.sum ./
14
14
15
15
# Download modules
16
16
RUN go mod download
17
17
18
18
# Run tests in apt package
19
- CMD ["go" , "test" , "-v" , "./ " ]
19
+ ENTRYPOINT ["go" , "test" ]
You can’t perform that action at this time.
0 commit comments