Skip to content

Commit 745aa44

Browse files
committed
Use standardized name for build and test tasks
This is the naming convention established in the standardized template project assets.
1 parent 5dc498b commit 745aa44

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

.github/workflows/test-go-integration-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ jobs:
5757
run: pip install poetry
5858

5959
- name: Run integration tests
60-
run: task test-integration
60+
run: task go:test-integration

.github/workflows/test-go-task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
version: 3.x
4949

5050
- name: Run unit tests
51-
run: task go:test-unit
51+
run: task go:test
5252

5353
- name: Send unit tests coverage to Codecov
5454
if: matrix.operating-system == 'ubuntu-latest'

Taskfile.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,20 @@ vars:
4141
tasks:
4242
build:
4343
desc: Build the project
44-
cmds:
45-
- go build -v {{.LDFLAGS}}
44+
deps:
45+
- task: go:build
4646

4747
test:
4848
desc: Run tests
4949
cmds:
50-
- task: go:test-unit
51-
- task: test-integration
50+
- task: go:test
51+
- task: go:test-integration
52+
53+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
54+
go:build:
55+
desc: Build the Go code
56+
cmds:
57+
- go build -v {{.LDFLAGS}}
5258

5359
go:generate:
5460
desc: Generate Go code
@@ -60,12 +66,12 @@ tasks:
6066
- go generate ./...
6167
- task: go:format
6268

63-
go:test-unit:
69+
go:test:
6470
desc: Run unit tests
6571
cmds:
6672
- go test -short -run '{{default ".*" .TEST_REGEX}}' {{default "-v" .GOFLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
6773

68-
test-integration:
74+
go:test-integration:
6975
desc: Run integration tests
7076
cmds:
7177
- task: build

docs/CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,26 @@ task test
118118
To run only the Go unit tests, run:
119119

120120
```
121-
task go:test-unit
121+
task go:test
122122
```
123123

124124
By default, all tests for all Arduino Lint's Go packages are run. To run unit tests for only one or more specific
125125
packages, you can set the `TARGETS` environment variable, e.g.:
126126

127127
```
128-
TARGETS=./internal/rule task go:test-unit
128+
TARGETS=./internal/rule task go:test
129129
```
130130

131131
Alternatively, to run only some specific test(s), you can specify a regex to match against the test function name, e.g.:
132132

133133
```
134-
TEST_REGEX='^TestLibraryProperties.*' task go:test-unit
134+
TEST_REGEX='^TestLibraryProperties.*' task go:test
135135
```
136136

137137
Both can be combined as well, typically to run only a specific test:
138138

139139
```
140-
TEST_REGEX='^TestFindProjects$' TARGETS=./internal/project task go:test-unit
140+
TEST_REGEX='^TestFindProjects$' TARGETS=./internal/project task go:test
141141
```
142142

143143
#### Integration tests
@@ -153,7 +153,7 @@ For these reasons, in addition to regular unit tests the project has a suite of
153153
After the software requirements have been installed, you should be able to run the tests with:
154154

155155
```
156-
task test-integration
156+
task go:test-integration
157157
```
158158

159159
This will automatically install the necessary dependencies, if not already installed, and run the integration tests

0 commit comments

Comments
 (0)