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 9999 - name : Run tests
100100 env :
101101 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
104103
105104 - name : Send unit tests coverage to Codecov
106105 if : runner.os == 'Linux'
Original file line number Diff line number Diff line change 1-
21version : " 3"
32
43vars :
1110 go list ./... | tr '\n' ' ' ||
1211 echo '"ERROR: Unable to discover Go packages"'
1312 )
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 :
1713
1814tasks :
1915 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
@@ -47,19 +43,6 @@ tasks:
4743 go:test :
4844 desc : Run unit tests
4945 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
6346 cmds :
6447 - 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) {
7171}
7272
7373func TestParseListUpgradableOutput (t * testing.T ) {
74- t .Run ("special cases" , func (t * testing.T ) {
74+ t .Run ("edges cases" , func (t * testing.T ) {
7575 tests := []struct {
7676 name string
7777 input string
@@ -84,7 +84,7 @@ func TestParseListUpgradableOutput(t *testing.T) {
8484 },
8585 {
8686 name : "line not matching regex" ,
87- input : "this-is-not- a-valid-line\n " ,
87+ input : "this-is-not a-valid-line\n " ,
8888 expected : []* Package {},
8989 },
9090 {
Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ RUN apt-get update && apt-get install -y \
1010WORKDIR /app
1111
1212# Copy everything (mod files + code)
13- COPY . .
13+ COPY go.mod go.sum ./
1414
1515# Download modules
1616RUN go mod download
1717
1818# 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