Skip to content

Commit 9261287

Browse files
author
Roberto Sora
committed
inject ldflags variables in build task in Taskfile.yml
1 parent 918c979 commit 9261287

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Taskfile.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
version: '2'
22

3-
vars:
4-
TEST_VERSIONSTRING: "0.0.0-test.preview"
5-
TEST_COMMIT: "deadbeef"
6-
TEST_LDFLAGS_VALUE: >
7-
'-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
8-
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}'
9-
103
tasks:
114
build:
125
desc: Build the project
136
cmds:
14-
- go build -v -i
7+
- go build -v -i -ldflags {{.LDFLAGS_VALUE}}
158

169
test:
1710
desc: Run the full testsuite
@@ -28,3 +21,20 @@ tasks:
2821
desc: Run integration tests only
2922
cmds:
3023
- go test -run Integration {{ default "-v" .GOFLAGS }} {{ default "./..." .TARGETS }} -ldflags {{.TEST_LDFLAGS_VALUE}}
24+
25+
26+
vars:
27+
# build flags
28+
VERSIONSTRING: "0.3.6-alpha.preview"
29+
COMMIT:
30+
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`}
31+
LDFLAGS_VALUE: >
32+
'-X github.com/arduino/arduino-cli/version.versionString={{.VERSIONSTRING}}
33+
-X github.com/arduino/arduino-cli/version.commit={{.COMMIT}}'
34+
35+
# test flags
36+
TEST_VERSIONSTRING: "0.0.0-test.preview"
37+
TEST_COMMIT: "deadbeef"
38+
TEST_LDFLAGS_VALUE: >
39+
'-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
40+
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}'

0 commit comments

Comments
 (0)