Skip to content

Commit cc65201

Browse files
author
Roberto Sora
committed
replace commands in /travis.yml with tasks properly merging flags
1 parent 9261287 commit cc65201

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ env:
1111
# Make sure golangci-lint is vendored.
1212
before_install:
1313
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.16.0
14+
- go install github.com/go-task/task/cmd/task
15+
1416

1517
install: true
1618

@@ -20,9 +22,10 @@ script:
2022
# Run linter
2123
- golangci-lint run
2224
# Build and test
23-
- go build
24-
- go test -timeout 20m -v -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic ./...
25+
- task build
26+
- task test
2527

2628
after_success:
27-
- bash <(curl -s https://codecov.io/bash)
29+
- bash <(curl -s https://codecov.io/bash) -cF unittests,integration
30+
2831

Taskfile.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tasks:
44
build:
55
desc: Build the project
66
cmds:
7-
- go build -v -i -ldflags {{.LDFLAGS_VALUE}}
7+
- go build -v -i {{.LDFLAGS}}
88

99
test:
1010
desc: Run the full testsuite
@@ -15,26 +15,26 @@ tasks:
1515
test-unit:
1616
desc: Run unit tests only
1717
cmds:
18-
- go test -short {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }}
18+
- go test -short {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default "./..." .TARGETS }}
1919

2020
test-integration:
2121
desc: Run integration tests only
2222
cmds:
23-
- go test -run Integration {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }} -ldflags {{.TEST_LDFLAGS_VALUE}}
24-
23+
- go test -run Integration {{ default "-v" .GOFLAGS }} -coverprofile=coverage_integ.txt {{ default "./..." .TARGETS }} {{.TEST_LDFLAGS}}
2524

2625
vars:
27-
# build flags
26+
# build vars
2827
VERSIONSTRING: "0.3.6-alpha.preview"
2928
COMMIT:
3029
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`}
31-
LDFLAGS_VALUE: >
32-
'-X github.com/arduino/arduino-cli/version.versionString={{.VERSIONSTRING}}
30+
LDFLAGS: >
31+
-ldflags '-X github.com/arduino/arduino-cli/version.versionString={{.VERSIONSTRING}}
3332
-X github.com/arduino/arduino-cli/version.commit={{.COMMIT}}'
3433
35-
# test flags
34+
# test vars
35+
GOFLAGS: "-timeout 5m -v -coverpkg=./... -covermode=atomic"
3636
TEST_VERSIONSTRING: "0.0.0-test.preview"
3737
TEST_COMMIT: "deadbeef"
38-
TEST_LDFLAGS_VALUE: >
39-
'-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
38+
TEST_LDFLAGS: >
39+
-ldflags '-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
4040
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}'

0 commit comments

Comments
 (0)