Skip to content

Commit 60bfeff

Browse files
committed
Initial commit.
0 parents  commit 60bfeff

16 files changed

+501
-0
lines changed

.codespellrc

Lines changed: 9 additions & 0 deletions
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 = wan,
6+
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
7+
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
8+
- package-ecosystem: github-actions
9+
directory: / # Check the repository's workflows under /.github/workflows/
10+
schedule:
11+
interval: daily
12+
labels:
13+
- "topic: ci"

.github/workflows/arduino-lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Arduino Lint
2+
on:
3+
push:
4+
pull_request:
5+
# Scheduled trigger checks for breakage caused by new rules added to Arduino Lint
6+
schedule:
7+
# run every Saturday at 3 AM UTC
8+
- cron: "0 3 * * 6"
9+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch
10+
workflow_dispatch:
11+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#repository_dispatch
12+
repository_dispatch:
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Arduino Lint
23+
uses: arduino/arduino-lint-action@v1
24+
with:
25+
project-type: library
26+
library-manager: submit
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Compile Examples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/compile-examples.yml"
7+
- "examples/**"
8+
- "src/**"
9+
push:
10+
paths:
11+
- ".github/workflows/compile-examples.yml"
12+
- "examples/**"
13+
- "src/**"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
env:
20+
SKETCHES_REPORTS_PATH: sketches-reports
21+
LIBRARIES: |
22+
# Install the library from the local path.
23+
- source-path: ./
24+
25+
strategy:
26+
fail-fast: false
27+
28+
matrix:
29+
board:
30+
- fqbn: rp2040:rp2040:arduino_nano_connect
31+
platforms: |
32+
- name: rp2040:rp2040
33+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
34+
- fqbn: rp2040:rp2040:rpipico
35+
platforms: |
36+
- name: rp2040:rp2040
37+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v3
42+
43+
- name: Install ESP32 platform dependencies
44+
if: startsWith(matrix.board.fqbn, 'esp32:esp32')
45+
run: pip3 install pyserial
46+
47+
- name: Compile examples
48+
uses: arduino/compile-sketches@main
49+
with:
50+
fqbn: ${{ matrix.board.fqbn }}
51+
platforms: ${{ matrix.board.platforms }}
52+
libraries: ${{ env.LIBRARIES }}
53+
enable-deltas-report: true
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
56+
57+
- name: Save memory usage change report as artifact
58+
if: github.event_name == 'pull_request'
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: ${{ env.SKETCHES_REPORTS_PATH }}
62+
path: ${{ env.SKETCHES_REPORTS_PATH }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Extra Library Checks
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
extra-library-checks:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
ARDUINO_CI_SCRIPT_FOLDER: extras/ci-tools/arduino-ci-script
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Install arduino-ci-script
19+
run: |
20+
# install arduino-ci-script
21+
git clone https://github.com/per1234/arduino-ci-script.git "$ARDUINO_CI_SCRIPT_FOLDER"
22+
cd "$ARDUINO_CI_SCRIPT_FOLDER"
23+
# Get new tags from the remote
24+
git fetch --tags
25+
# Checkout the latest tag
26+
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
27+
28+
# See: https://github.com/per1234/arduino-ci-script#check_keywords_txt-searchpath-maximumsearchdepth
29+
- name: Check keywords.txt
30+
run: |
31+
source "${ARDUINO_CI_SCRIPT_FOLDER}/arduino-ci-script.sh"
32+
check_keywords_txt "$GITHUB_WORKSPACE"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: General Formatting Checks
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
general-formatting-checks:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
# https://github.com/per1234/formatting-checks
16+
- name: Check for files starting with a blank line
17+
run: find . -path './.git' -prune -or -path './src/types' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
18+
19+
- name: Check for unnecessary use of true tabs
20+
run: find . -path './.git' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or \( -not -name 'keywords.txt' -and -not -name '.gitmodules' -and -type f \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
21+
22+
- name: Check for trailing whitespace
23+
run: find . -path './.git' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
24+
25+
- name: Check for non-Unix line endings
26+
run: find . -path './.git' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
27+
28+
- name: Check for blank lines at end of files
29+
run: find . -path './.git' -prune -or -path './src/types' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
30+
31+
- name: Check for files that don't end in a newline
32+
# https://stackoverflow.com/a/25686825
33+
run: find . -path './.git' -prune -or -path './src/types' -prune -or -path './libcanard' -prune -or -path './extras/test/external' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Report Size Deltas
2+
3+
on:
4+
schedule:
5+
- cron: '*/5 * * * *'
6+
7+
jobs:
8+
report:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
# See: https://github.com/arduino/report-size-deltas/README.md
13+
- name: Comment size deltas reports to PRs
14+
uses: arduino/report-size-deltas@main

.github/workflows/spell-check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/spell-check.md
2+
name: Spell Check
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 new misspelling detections resulting from dictionary updates.
10+
- cron: "0 8 * * TUE"
11+
workflow_dispatch:
12+
repository_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
spellcheck:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: Spell check
26+
uses: codespell-project/actions-codespell@master

.github/workflows/sync-labels.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
2+
name: Sync Labels
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/sync-labels.ya?ml"
9+
- ".github/label-configuration-files/*.ya?ml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/sync-labels.ya?ml"
13+
- ".github/label-configuration-files/*.ya?ml"
14+
schedule:
15+
# run every Tuesday at 3 AM UTC
16+
- cron: "0 3 * * 2"
17+
workflow_dispatch:
18+
repository_dispatch:
19+
20+
env:
21+
CONFIGURATIONS_FOLDER: .github/label-configuration-files
22+
CONFIGURATIONS_ARTIFACT: label-configuration-files
23+
24+
jobs:
25+
check:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v3
31+
32+
- name: Download JSON schema for labels configuration file
33+
id: download-schema
34+
uses: carlosperate/[email protected]
35+
with:
36+
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json
37+
location: ${{ runner.temp }}/label-configuration-schema
38+
39+
- name: Install JSON schema validator
40+
run: |
41+
sudo npm install \
42+
--global \
43+
ajv-cli \
44+
ajv-formats
45+
46+
- name: Validate local labels configuration
47+
run: |
48+
# See: https://github.com/ajv-validator/ajv-cli#readme
49+
ajv validate \
50+
--all-errors \
51+
-c ajv-formats \
52+
-s "${{ steps.download-schema.outputs.file-path }}" \
53+
-d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}"
54+
55+
download:
56+
needs: check
57+
runs-on: ubuntu-latest
58+
59+
strategy:
60+
matrix:
61+
filename:
62+
# Filenames of the shared configurations to apply to the repository in addition to the local configuration.
63+
# https://github.com/107-systems/.github/blob/main/workflow-templates/assets/sync-labels
64+
- universal.yml
65+
66+
steps:
67+
- name: Download
68+
uses: carlosperate/[email protected]
69+
with:
70+
file-url: https://raw.githubusercontent.com/107-systems/.github/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}
71+
72+
- name: Pass configuration files to next job via workflow artifact
73+
uses: actions/upload-artifact@v3
74+
with:
75+
path: |
76+
*.yaml
77+
*.yml
78+
if-no-files-found: error
79+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
80+
81+
sync:
82+
needs: download
83+
runs-on: ubuntu-latest
84+
85+
steps:
86+
- name: Set environment variables
87+
run: |
88+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
89+
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
90+
91+
- name: Determine whether to dry run
92+
id: dry-run
93+
if: >
94+
github.event == 'pull_request' ||
95+
github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
96+
run: |
97+
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
98+
# configuration.
99+
echo "::set-output name=flag::--dry-run"
100+
101+
- name: Checkout repository
102+
uses: actions/checkout@v3
103+
104+
- name: Download configuration files artifact
105+
uses: actions/download-artifact@v3
106+
with:
107+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
108+
path: ${{ env.CONFIGURATIONS_FOLDER }}
109+
110+
- name: Remove unneeded artifact
111+
uses: geekyeggo/delete-artifact@v2
112+
with:
113+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
114+
115+
- name: Merge label configuration files
116+
run: |
117+
# Merge all configuration files
118+
shopt -s extglob
119+
cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}"
120+
121+
- name: Install github-label-sync
122+
run: sudo npm install --global github-label-sync
123+
124+
- name: Sync labels
125+
env:
126+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
run: |
128+
# See: https://github.com/Financial-Times/github-label-sync
129+
github-label-sync \
130+
--labels "${{ env.MERGED_CONFIGURATION_PATH }}" \
131+
${{ steps.dry-run.outputs.flag }} \
132+
${{ github.repository }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

0 commit comments

Comments
 (0)