Skip to content

Commit f0c6fe6

Browse files
authored
chore: add common scripts and config (#4)
1 parent 1a95d2e commit f0c6fe6

File tree

8 files changed

+84
-9
lines changed

8 files changed

+84
-9
lines changed

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default configuration for all files
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 2
13+
14+
# Use utf-8 charset for modern languages
15+
[*.{go}]
16+
charset = utf-8
17+
18+
# Use tab indentation for Go and Makefiles
19+
[{*.go,go.*}]
20+
indent_style = tab
21+
indent_size = 4
22+

.github/workflows/go-checks.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ jobs:
3636
run: |
3737
go mod tidy
3838
git diff --color --exit-code
39-

.github/workflows/go-test.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
pull_request:
77
branches: [main]
88

9-
env:
10-
GO_VERSION: "1.25.1"
11-
129
# In the same branch only 1 workflow per time can run. In case we're not in the
1310
# main branch we cancel previous running workflow
1411
concurrency:
@@ -25,8 +22,7 @@ jobs:
2522
- name: Set up Go
2623
uses: actions/setup-go@v5
2724
with:
28-
go-version: ${{ env.GO_VERSION }}
25+
go-version-file: go.mod
2926

3027
- name: Run tests
31-
run: go test -v --race ./...
32-
28+
run: go tool task test

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- "*" # Trigger on all tags
77

88
env:
9-
GO_VERSION: "1.25.1"
109
PROJECT_NAME: "remoteocd"
1110
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
1211
GITHUB_USERNAME: ArduinoBot
@@ -47,7 +46,7 @@ jobs:
4746
- name: Set up Go
4847
uses: actions/setup-go@v5
4948
with:
50-
go-version: ${{ env.GO_VERSION }}
49+
go-version-file: go.mod
5150

5251
- name: Build Binary
5352
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
2+
.bin/
23

34
# Mac system files
45
.DS_Store

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Flexible firmware flashing for the Arduino UNO Q Microcontroller.
44

55
`remoteocd` is a specialized utility designed to manage firmware deployment for the Arduino UNO Q board.
66
This tool acts as a versatile wrapper for OpenOCD (Open On-Chip Debugger), allowing you to flash a binary onto the MCU using one of three transparently handled modes:
7+
78
- Local, by flashing from the UNO Q's MPU (Linux) environment.
89
- ADB over USB.
910
- SSH over a remote pc.

Taskfile.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,58 @@
11
version: "3"
22

3+
vars:
4+
GOLANGCI_LINT_VERSION: v2.4.0
5+
GOIMPORTS_VERSION: v0.29.0
6+
DPRINT_VERSION: 0.48.0
7+
38
tasks:
9+
init:
10+
desc: Setup local env
11+
deps:
12+
- install:linter
13+
- install:goimports
14+
- install:dprint
15+
16+
install:linter:
17+
cmds:
18+
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b .bin/ {{ .GOLANGCI_LINT_VERSION }}
19+
20+
install:goimports:
21+
cmds:
22+
- go install golang.org/x/tools/cmd/goimports@{{ .GOIMPORTS_VERSION }}
23+
24+
install:dprint:
25+
cmds:
26+
- curl -fsSL https://dprint.dev/install.sh | sh -s {{ .DPRINT_VERSION }}
27+
- mkdir -p .bin && cp $HOME/.dprint/bin/dprint .bin/dprint # workaround for local install
28+
429
go:add-license-headers:
530
desc: Add missing go license headers
631
cmds:
732
- go install github.com/google/addlicense@v1.2.0
833
- addlicense -c "ARDUINO SA (http://www.arduino.cc/)" -f ./license_header.tpl $(find . -name "*.go" -type f -print0 | xargs -0)
934

35+
test:
36+
desc: Run go tests
37+
cmds:
38+
- go test ./... -v -race {{ .CLI_ARGS }}
39+
40+
lint:
41+
desc: Run the linters
42+
cmds:
43+
- ${PWD}/.bin/golangci-lint run --fix -v --timeout 300s {{ .CLI_ARGS }}
44+
45+
fmt:
46+
desc: Run format
47+
cmds:
48+
- goimports -l -w .
49+
- ${PWD}/.bin/dprint fmt
50+
51+
fmt-check:
52+
desc: Check format
53+
cmds:
54+
- ${PWD}/.bin/dprint check
55+
1056
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml
1157
general:cache-dep-licenses:
1258
desc: Cache dependency license metadata

dprint.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"markdown": {},
3+
"yaml": {},
4+
"excludes": [
5+
".licenses/**"
6+
],
7+
"plugins": [
8+
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
9+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
10+
]
11+
}

0 commit comments

Comments
 (0)