Skip to content

Commit 3e41455

Browse files
authored
Sync testing infrastructure with "template" assets (#1388)
* [skip changelog] Sync testing infrastructure with "template" assets We have assembled a collection of reusable project assets: https://github.com/arduino/tooling-project-assets These will be used in the repositories of all Arduino tooling projects. Some minor improvements and standardizations have been made in the upstream "template" assets, and those are hereby introduced to this repository. Notable: - Configure paths filters to avoid unnecessary workflow runs - Increased parallelism - Improved maintainability * Remove obsolete testing tasks The sync with the template testing assets has resulted in new standardized names for some of the test runner tasks: - `test-unit` -> `go:test` - `test-integration` -> `go:test-integration` * [skip changelog] Update package names in imports As of Go 1.7 the `golang.org/x/net/context` package is available in the standard library under the name `context`. * [skip changelog] Tidy root module dependencies Result of running `go mod tidy` with Go 1.16.6. * [skip changelog] Tidy `github.com/arduino/arduino-cli/arduino/discovery/discovery_client` module's dependencies Result of running `go mod tidy` with Go 1.16.6. * [skip changelog] Tidy `github.com/arduino/arduino-cli/term_example` module's dependencies Result of running `go mod tidy` with Go 1.16.6. * [skip changelog] Tidy `github.com/arduino/arduino-cli/docsgen` module's dependencies Result of running `go mod tidy` with Go 1.16.6.
1 parent 5bce623 commit 3e41455

19 files changed

+745
-291
lines changed

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

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md
2+
name: Check Go
3+
4+
env:
5+
# See: https://github.com/actions/setup-go/tree/v2#readme
6+
GO_VERSION: "1.16"
7+
8+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/check-go-task.ya?ml"
13+
- "Taskfile.ya?ml"
14+
- "**/go.mod"
15+
- "**/go.sum"
16+
- "**.go"
17+
pull_request:
18+
paths:
19+
- ".github/workflows/check-go-task.ya?ml"
20+
- "Taskfile.ya?ml"
21+
- "**/go.mod"
22+
- "**/go.sum"
23+
- "**.go"
24+
workflow_dispatch:
25+
repository_dispatch:
26+
27+
jobs:
28+
check-errors:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
35+
- name: Install Go
36+
uses: actions/setup-go@v2
37+
with:
38+
go-version: ${{ env.GO_VERSION }}
39+
40+
- name: Install Task
41+
uses: arduino/setup-task@v1
42+
with:
43+
repo-token: ${{ secrets.GITHUB_TOKEN }}
44+
version: 3.x
45+
46+
- name: Check for errors
47+
run: task go:vet
48+
49+
check-outdated:
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v2
55+
56+
- name: Install Go
57+
uses: actions/setup-go@v2
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
61+
- name: Install Task
62+
uses: arduino/setup-task@v1
63+
with:
64+
repo-token: ${{ secrets.GITHUB_TOKEN }}
65+
version: 3.x
66+
67+
- name: Modernize usages of outdated APIs
68+
run: task go:fix
69+
70+
- name: Check if any fixes were needed
71+
run: git diff --color --exit-code
72+
73+
check-style:
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout repository
78+
uses: actions/checkout@v2
79+
80+
- name: Install Go
81+
uses: actions/setup-go@v2
82+
with:
83+
go-version: ${{ env.GO_VERSION }}
84+
85+
- name: Install Task
86+
uses: arduino/setup-task@v1
87+
with:
88+
repo-token: ${{ secrets.GITHUB_TOKEN }}
89+
version: 3.x
90+
91+
- name: Install golint
92+
run: go install golang.org/x/lint/golint@latest
93+
94+
- name: Check style
95+
run: task --silent go:lint
96+
97+
check-formatting:
98+
runs-on: ubuntu-latest
99+
100+
steps:
101+
- name: Checkout repository
102+
uses: actions/checkout@v2
103+
104+
- name: Install Go
105+
uses: actions/setup-go@v2
106+
with:
107+
go-version: ${{ env.GO_VERSION }}
108+
109+
- name: Install Task
110+
uses: arduino/setup-task@v1
111+
with:
112+
repo-token: ${{ secrets.GITHUB_TOKEN }}
113+
version: 3.x
114+
115+
- name: Format code
116+
run: task go:format
117+
118+
- name: Check formatting
119+
run: git diff --color --exit-code
120+
121+
check-config:
122+
name: check-config (${{ matrix.module.path }})
123+
runs-on: ubuntu-latest
124+
125+
strategy:
126+
fail-fast: false
127+
128+
matrix:
129+
module:
130+
- path: ./
131+
- path: arduino/discovery/discovery_client
132+
- path: client_example
133+
- path: commands/daemon/term_example
134+
- path: docsgen
135+
136+
steps:
137+
- name: Checkout repository
138+
uses: actions/checkout@v2
139+
140+
- name: Install Go
141+
uses: actions/setup-go@v2
142+
with:
143+
go-version: ${{ env.GO_VERSION }}
144+
145+
- name: Run go mod tidy
146+
working-directory: ${{ matrix.module.path }}
147+
run: go mod tidy
148+
149+
- name: Check whether any tidying was needed
150+
run: git diff --color --exit-code
151+
152+
# Do a simple "smoke test" build for the modules with no other form of validation
153+
build:
154+
name: build (${{ matrix.module.path }})
155+
runs-on: ubuntu-latest
156+
157+
strategy:
158+
fail-fast: false
159+
160+
matrix:
161+
module:
162+
- path: arduino/discovery/discovery_client
163+
- path: client_example
164+
- path: commands/daemon/term_example
165+
166+
steps:
167+
- name: Checkout repository
168+
uses: actions/checkout@v2
169+
170+
- name: Install Go
171+
uses: actions/setup-go@v2
172+
with:
173+
go-version: ${{ env.GO_VERSION }}
174+
175+
- name: Build
176+
working-directory: ${{ matrix.module.path }}
177+
run: go build

.github/workflows/check-i18n-task.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Check Internationalization
2+
3+
env:
4+
# See: https://github.com/actions/setup-go/tree/v2#readme
5+
GO_VERSION: "1.16"
6+
7+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
on:
9+
push:
10+
paths:
11+
- ".github/workflows/check-i18n-task.ya?ml"
12+
- "Taskfile.ya?ml"
13+
- "go.mod"
14+
- "go.sum"
15+
- "**.go"
16+
- "i18n/**"
17+
pull_request:
18+
paths:
19+
- ".github/workflows/check-i18n-task.ya?ml"
20+
- "Taskfile.ya?ml"
21+
- "go.mod"
22+
- "go.sum"
23+
- "**.go"
24+
- "i18n/**"
25+
workflow_dispatch:
26+
repository_dispatch:
27+
28+
jobs:
29+
check:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v2
35+
36+
- name: Install Go
37+
uses: actions/setup-go@v2
38+
with:
39+
go-version: ${{ env.GO_VERSION }}
40+
41+
- name: Install go.rice
42+
run: go get github.com/cmaglie/go.rice/rice
43+
44+
- name: Install Task
45+
uses: arduino/setup-task@v1
46+
with:
47+
repo-token: ${{ secrets.GITHUB_TOKEN }}
48+
version: 3.x
49+
50+
- name: Check for errors
51+
run: task i18n:check
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Check Protocol Buffers
2+
3+
env:
4+
# See: https://github.com/actions/setup-go/tree/v2#readme
5+
GO_VERSION: "1.16"
6+
7+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
on:
9+
push:
10+
paths:
11+
- ".github/workflows/check-protobuf-task.ya?ml"
12+
- "Taskfile.ya?ml"
13+
- "rpc/**"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-protobuf-task.ya?ml"
17+
- "Taskfile.ya?ml"
18+
- "rpc/**"
19+
workflow_dispatch:
20+
repository_dispatch:
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
30+
- name: Install Go
31+
uses: actions/setup-go@v2
32+
with:
33+
go-version: ${{ env.GO_VERSION }}
34+
35+
- name: Install protoc compiler
36+
uses: arduino/setup-protoc@v1
37+
with:
38+
version: v3.16.0
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Install Go deps
42+
run: |
43+
go install google.golang.org/protobuf/cmd/[email protected]
44+
go install google.golang.org/grpc/cmd/[email protected]
45+
46+
- name: Install Task
47+
uses: arduino/setup-task@v1
48+
with:
49+
repo-token: ${{ secrets.GITHUB_TOKEN }}
50+
version: 3.x
51+
52+
- name: Check protocol buffers compile correctly
53+
if: runner.os == 'Linux'
54+
run: task protoc:compile
55+
56+
check:
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v2
62+
63+
- name: Install Go
64+
uses: actions/setup-go@v2
65+
with:
66+
go-version: ${{ env.GO_VERSION }}
67+
68+
- name: Install buf (protoc linter)
69+
run: |
70+
go install github.com/bufbuild/buf/cmd/buf@latest
71+
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking@latest
72+
go install github.com/bufbuild/buf/cmd/protoc-gen-buf-lint@latest
73+
74+
- name: Install Task
75+
uses: arduino/setup-task@v1
76+
with:
77+
repo-token: ${{ secrets.GITHUB_TOKEN }}
78+
version: 3.x
79+
80+
- name: Lint protocol buffers
81+
run: task protoc:check

0 commit comments

Comments
 (0)