Skip to content

Commit e584d29

Browse files
umbynoscmaglie
authored andcommitted
(TODO rename and adapt stuff around)
1 parent 7179dae commit e584d29

20 files changed

+2133
-0
lines changed

.codespellrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = ,
6+
builtin = clear,informal,en-GB_to_en-US
7+
check-filenames =
8+
check-hidden =
9+
skip = ./.git,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock

.ecrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"Exclude": [
3+
"LICENSE.txt",
4+
"poetry.lock"
5+
]
6+
}

.editorconfig

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/.editorconfig
2+
# See: https://editorconfig.org/
3+
# The formatting style defined in this file is the official standardized style to be used in all Arduino Tooling
4+
# projects and should not be modified.
5+
# Note: indent style for each file type is defined even when it matches the universal config in order to make it clear
6+
# that this type has an official style.
7+
8+
[*]
9+
charset = utf-8
10+
end_of_line = lf
11+
indent_size = 2
12+
indent_style = space
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true
15+
16+
[*.{adoc,asc,asciidoc}]
17+
indent_size = 2
18+
indent_style = space
19+
20+
[*.{bash,sh}]
21+
indent_size = 2
22+
indent_style = space
23+
24+
[*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}]
25+
indent_size = 2
26+
indent_style = space
27+
28+
[*.{go,mod}]
29+
indent_style = tab
30+
31+
[*.java]
32+
indent_size = 2
33+
indent_style = space
34+
35+
[*.{js,jsx,json,jsonc,json5,ts,tsx}]
36+
indent_size = 2
37+
indent_style = space
38+
39+
[*.{md,mdx,mkdn,mdown,markdown}]
40+
indent_size = unset
41+
indent_style = space
42+
43+
[*.proto]
44+
indent_size = 2
45+
indent_style = space
46+
47+
[*.py]
48+
indent_size = 4
49+
indent_style = space
50+
51+
[*.svg]
52+
indent_size = 2
53+
indent_style = space
54+
55+
[*.{yaml,yml}]
56+
indent_size = 2
57+
indent_style = space
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build dummy discovery
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-20.04
10+
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v1
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install Taskfile
18+
uses: arduino/setup-task@v1
19+
with:
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
version: 3.x
22+
23+
- name: Install Go
24+
uses: actions/setup-go@v2
25+
with:
26+
go-version: "1.16"
27+
28+
- name: Build
29+
run: task build-dummy-discovery
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md
2+
name: Check General Formatting
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
pull_request:
8+
schedule:
9+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools.
10+
- cron: "0 8 * * TUE"
11+
workflow_dispatch:
12+
repository_dispatch:
13+
14+
jobs:
15+
check:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Set environment variables
20+
run: |
21+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
22+
echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV"
23+
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Install Task
28+
uses: arduino/setup-task@v1
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
version: 3.x
32+
33+
- name: Download latest editorconfig-checker release binary package
34+
id: download
35+
uses: MrOctopus/[email protected]
36+
with:
37+
repository: editorconfig-checker/editorconfig-checker
38+
excludes: prerelease, draft
39+
asset: linux-amd64.tar.gz
40+
target: ${{ env.EC_INSTALL_PATH }}
41+
42+
- name: Install editorconfig-checker
43+
run: |
44+
cd "${{ env.EC_INSTALL_PATH }}"
45+
tar --extract --file="${{ steps.download.outputs.name }}"
46+
# Give the binary a standard name
47+
mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec"
48+
# Add installation to PATH:
49+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
50+
echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH"
51+
52+
- name: Check formatting
53+
run: task --silent general:check-formatting

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

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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+
132+
steps:
133+
- name: Checkout repository
134+
uses: actions/checkout@v2
135+
136+
- name: Install Go
137+
uses: actions/setup-go@v2
138+
with:
139+
go-version: ${{ env.GO_VERSION }}
140+
141+
- name: Run go mod tidy
142+
working-directory: ${{ matrix.module.path }}
143+
run: go mod tidy
144+
145+
- name: Check whether any tidying was needed
146+
run: git diff --color --exit-code

.github/workflows/check-taskfiles.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
2+
name: Check Taskfiles
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-taskfiles.ya?ml"
9+
- "**/Taskfile.ya?ml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/check-taskfiles.ya?ml"
13+
- "**/Taskfile.ya?ml"
14+
schedule:
15+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
16+
- cron: "0 8 * * TUE"
17+
workflow_dispatch:
18+
repository_dispatch:
19+
20+
jobs:
21+
validate:
22+
name: Validate ${{ matrix.file }}
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
fail-fast: false
27+
28+
matrix:
29+
file:
30+
# TODO: add paths to any additional Taskfiles here
31+
- ./**/Taskfile.yml
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v2
36+
37+
- name: Download JSON schema for Taskfiles
38+
id: download-schema
39+
uses: carlosperate/[email protected]
40+
with:
41+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
42+
file-url: https://json.schemastore.org/taskfile.json
43+
location: ${{ runner.temp }}/taskfile-schema
44+
45+
- name: Install JSON schema validator
46+
run: |
47+
sudo npm install \
48+
--global \
49+
ajv-cli \
50+
ajv-formats
51+
- name: Validate ${{ matrix.file }}
52+
run: |
53+
# See: https://github.com/ajv-validator/ajv-cli#readme
54+
ajv validate \
55+
--all-errors \
56+
--strict=false \
57+
-c ajv-formats \
58+
-s "${{ steps.download-schema.outputs.file-path }}" \
59+
-d "${{ matrix.file }}"

0 commit comments

Comments
 (0)