Skip to content

Commit e0774cf

Browse files
authored
Merge pull request #62 from per1234/test-go
Sync "Test Go" CI workflow with template
2 parents 9d7084e + 002cce6 commit e0774cf

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/test-go-task.md
12
name: Test Go
23

34
env:
@@ -8,18 +9,22 @@ env:
89
on:
910
push:
1011
paths:
11-
- ".github/workflows/test-go.yml"
12-
- "Taskfile.yml"
13-
- "**.go"
12+
- ".github/workflows/test-go-task.ya?ml"
13+
- "codecov.ya?ml"
1414
- "go.mod"
1515
- "go.sum"
16+
- "Taskfile.ya?ml"
17+
- "**.go"
18+
- "**/testdata/**"
1619
pull_request:
1720
paths:
18-
- ".github/workflows/test-go.yml"
19-
- "Taskfile.yml"
20-
- "**.go"
21+
- ".github/workflows/test-go-task.ya?ml"
22+
- "codecov.ya?ml"
2123
- "go.mod"
2224
- "go.sum"
25+
- "Taskfile.ya?ml"
26+
- "**.go"
27+
- "**/testdata/**"
2328
workflow_dispatch:
2429
repository_dispatch:
2530

@@ -36,11 +41,19 @@ jobs:
3641
with:
3742
go-version: ${{ env.GO_VERSION }}
3843

39-
- name: Install Taskfile
44+
- name: Install Task
4045
uses: arduino/setup-task@v1
4146
with:
4247
repo-token: ${{ secrets.GITHUB_TOKEN }}
4348
version: 3.x
4449

4550
- name: Run tests
4651
run: task go:test
52+
53+
- name: Send unit tests coverage to Codecov
54+
if: matrix.operating-system == 'ubuntu-latest'
55+
uses: codecov/codecov-action@v2
56+
with:
57+
file: ./coverage_unit.txt
58+
flags: unit
59+
fail_ci_if_error: true

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Arduino Library Manager submission parser
22

3-
[![Test Go status](https://github.com/arduino/library-registry-submission-parser/actions/workflows/test-go.yml/badge.svg)](https://github.com/arduino/library-registry-submission-parser/actions/workflows/test-go.yml)
3+
[![Test Go status](https://github.com/arduino/library-registry-submission-parser/actions/workflows/test-go-task.yml/badge.svg)](https://github.com/arduino/library-registry-submission-parser/actions/workflows/test-go-task.yml)
4+
[![Codecov](https://codecov.io/gh/arduino/library-registry-submission-parser/branch/main/graph/badge.svg)](https://codecov.io/gh/arduino/library-registry-submission-parser)
45
[![Check Go status](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-go.yml/badge.svg)](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-go.yml)
56
[![Check Python status](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-python-task.yml)
67
[![Check Prettier Formatting status](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/library-registry-submission-parser/actions/workflows/check-prettier-formatting-task.yml)

Taskfile.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ tasks:
2828
cmds:
2929
- go build -v {{.GO_BUILD_FLAGS}}
3030

31+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
3132
go:test:
3233
desc: Run unit tests
3334
cmds:
34-
- go 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}}
35+
- |
36+
go test \
37+
-v \
38+
-short \
39+
-run '{{default ".*" .GO_TEST_REGEX}}' \
40+
{{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
41+
-coverprofile=coverage_unit.txt \
42+
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
3543
3644
go:test-integration:
3745
desc: Run integration tests

0 commit comments

Comments
 (0)