Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .cspell.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "0.2"
words:
- adafruit
- armhf
- bndy
- BUILDSWIGNODE
- CFLAGS
- cpack
- Doxyfile
- elif
- fqbn
- gnueabihf
- gnux
- libboost
- libclang
- libncurses
- mbed
- megaavr
- MQTT
- MRAA
- pigpio
- pipx
- pkgs
- samd
- Seeeduino
- setuptools
- SPIDEV
- zizmor
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.toml text eol=lf
*.py text eol=lf
*.md text eol=lf
*.txt text eol=lf
*.scss text eol=lf
*.html text eol=lf
LICENSE text eol=lf
.gitignore text eol=lf
.gitattributes text eol=lf
34 changes: 26 additions & 8 deletions .github/workflows/cliff.toml → .github/cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ Full commit diff: [`{% if previous.version -%}
{%- endif %}...{{ last_commit }}`][{{ this_version }}]
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors
{%- endif -%}
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
- \\@{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor %}
{% endif %}

{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* \\@{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor %}\n
"""
# template for the changelog footer
footer = """
Expand All @@ -95,6 +95,7 @@ commit_preprocessors = [
]
# regex for parsing and grouping commits
commit_parsers = [
# The order of parsers matters. Put rules for PR labels first to prioritize PR labels.
{ field = "github.pr_labels", pattern = "breaking", group = "<!-- 0 --> 💥 Breaking changes" },
{ field = "github.pr_labels", pattern = "breaking-change", group = "<!-- 0 --> 💥 Breaking changes" },
{ field = "github.pr_labels", pattern = "feature", group = "<!-- 1 --> 🚀 Added" },
Expand All @@ -111,7 +112,24 @@ commit_parsers = [
{ field = "github.pr_labels", pattern = "skip-changelog", skip = true },
{ field = "github.pr_labels", pattern = "no-changelog", skip = true },
{ field = "github.pr_labels", pattern = "invalid", skip = true },
# The order of parsers matters. Put rules for PR labels first to prioritize PR labels.
# Here are rules that apply to conventional commits
{ field = "group", pattern = "add", group = "<!-- 1 --> 🚀 Added" },
{ field = "group", pattern = "feat", group = "<!-- 1 --> 🚀 Added" },
{ field = "group", pattern = "fix", group = "<!-- 4 --> 🛠️ Fixed" },
{ field = "group", pattern = "perf", group = "<!-- 13 --> ⚡ Performance" },
{ field = "group", pattern = "build", group = "<!-- 6 --> 📦 Dependency updates" },
{ field = "group", pattern = "test", group = "<!-- 7 --> 🚦 Tests" },
{ field = "group", pattern = "docs", group = "<!-- 8 --> 📝 Documentation" },
{ field = "group", pattern = "chore", group = "<!-- 9 --> 🗨️ Changed" },
{ field = "group", pattern = "style", group = "<!-- 9 --> 🗨️ Changed" },
# This rule seems broken when unconventional commits are involved.
# { field = "breaking", pattern = true, group = "<!-- 0 --> 💥 Breaking changes" },
{ field = "group", pattern = "remove", group = "<!-- 3 --> 🗑️ Removed" },
{ field = "group", pattern = "deprecate", group = "<!-- 2 --> 🚫 Deprecated" },
{ field = "group", pattern = "delete", group = "<!-- 3 --> 🗑️ Removed" },
{ field = "group", pattern = "security", group = "<!-- 5 --> 🔐 Security" },
{ field = "group", pattern = "refactor", group = "<!-- 9 --> 🗨️ Changed" },
# Here are rules that apply to unconventional commits
{ message = "^[a|A]dd", group = "<!-- 1 --> 🚀 Added" },
{ message = "^[s|S]upport", group = "<!-- 1 --> 🚀 Added" },
{ message = "^.*: support", group = "<!-- 1 --> 🚀 Added" },
Expand Down
15 changes: 14 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,21 @@ updates:
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
cooldown:
default-days: 5
groups:
actions:
patterns:
- "*"
- package-ecosystem: "pip"
# recursively finds requirements.txt files from repo root
directory: "/"
schedule:
interval: "monthly"
cooldown:
default-days: 5
groups:
pip:
patterns:
- "*"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from pathlib import Path
import re
import subprocess
from typing import cast, Tuple, List, Sequence, Dict
from typing import cast, Tuple, List, Set, Dict
from shutil import which
import sys
from difflib import unified_diff

Expand All @@ -26,7 +27,7 @@ def get_version() -> Tuple[VERSION_TUPLE, str]:
capture_output=True,
check=True,
)
tags: Sequence[VERSION_TUPLE] = set() # using a set to avoid duplicates
tags: Set[VERSION_TUPLE] = set() # using a set to avoid duplicates
tag_pattern = re.compile(r"tag:\s+(?:RF24)?v?(\d+\.\d+\.?[A-Za-z0-9-_]*)")
for line in result.stdout.decode(encoding="utf-8").splitlines():
ver_tags = cast(List[str], tag_pattern.findall(line))
Expand All @@ -40,10 +41,11 @@ def get_version() -> Tuple[VERSION_TUPLE, str]:
print(ver_tag, "is an incomplete version spec; appending zero(s)")
ver_tuple += (0,) * (3 - len(ver_tuple))
tags.add(cast(VERSION_TUPLE, ver_tuple))
tags = sorted(tags) # sort by version & converts to a list
tags.reverse() # to iterate from newest to oldest versions
sorted_tags = sorted(tags) # sort by version & converts to a list
sorted_tags.reverse() # to iterate from newest to oldest versions

print("found version tags:")
for tag in tags:
for tag in sorted_tags:
print(" v" + ".".join([str(t) for t in tag]), flush=True)

# get current branch
Expand All @@ -63,17 +65,17 @@ def get_version() -> Tuple[VERSION_TUPLE, str]:
# filter tags and find the appropriate latest tag according to current branch
if branch.endswith("1.x"):
print("filtering tags for branch", branch)
for tag in tags:
for tag in sorted_tags:
if tag[0] == 1:
ver_tag = tag
ret_ver = tag
break
else:
raise RuntimeError(f"Found no v1.x tags for branch {branch}")
else:
print("treating branch", repr(branch), "as latest stable branch", flush=True)
ver_tag = tags[0]
print("Current version:", ".".join([str(x) for x in ver_tag]), flush=True)
return ver_tag, branch
ret_ver = sorted_tags[0]
print("Current version:", ".".join([str(x) for x in ret_ver]), flush=True)
return ret_ver, branch


def increment_version(version: VERSION_TUPLE, bump: str = "patch") -> VERSION_TUPLE:
Expand All @@ -84,7 +86,7 @@ def increment_version(version: VERSION_TUPLE, bump: str = "patch") -> VERSION_TU
# zero out minor and patch components if needed
for i in range(component + 1, len(COMPONENTS)):
new_ver[i] = 0
return tuple(new_ver)
return (new_ver[0], new_ver[1], new_ver[2])


def get_changelog(
Expand All @@ -100,27 +102,27 @@ def get_changelog(
if full:
old = changelog.read_text(encoding="utf-8")
output = changelog
exe_name = "git-cliff"
if environ.get("CI", "false") == "true":
exe_name = (
(GIT_CLIFF_CONFIG.parent.parent.parent / exe_name).resolve().as_posix()
)
exe_name = which("git-cliff")
assert exe_name is not None, "git-cliff executable not found in PATH"
exe_name = Path(exe_name).as_posix()
args = [exe_name, "--use-branch-tags", "--github-repo", f"nRF24/{Path.cwd().name}"]
if not full:
args.append("--unreleased")
output = str(RELEASE_NOTES)
output = RELEASE_NOTES
env = {
"FIRST_COMMIT": first_commit,
"GIT_CLIFF_CONFIG": str(GIT_CLIFF_CONFIG),
"GIT_CLIFF_OUTPUT": str(output),
"GIT_CLIFF_TAG": f"v{tag}",
}
if "GITHUB_TOKEN" in environ:
env["GITHUB_TOKEN"] = environ["GITHUB_TOKEN"]
if not full:
env["GIT_CLIFF__CHANGELOG__HEADER"] = ""
subprocess.run(args, env=env, check=True)
if full:
new = changelog.read_text(encoding="utf-8")
changes = list(unified_diff(old, new))
changes = list(unified_diff(old.splitlines(), new.splitlines()))
return len(changes) != 0
return False

Expand Down Expand Up @@ -155,14 +157,14 @@ def update_metadata_files(version: str) -> bool:
if arduino_meta_file.exists():
# simple search and replace
ver_pattern = re.compile(r"version=(\d+\.\d+\.?\d*)")
data = arduino_meta_file.read_text(encoding="utf-8")
ver_match = ver_pattern.search(data)
ini_data = arduino_meta_file.read_text(encoding="utf-8")
ver_match = ver_pattern.search(ini_data)
assert ver_match is not None, "could not find version in " + str(
arduino_meta_file
)
if ver_match.group(1) != version:
data = ver_pattern.sub(f"version={version}", data)
arduino_meta_file.write_text(data, encoding="utf-8", newline="\n")
ini_data = ver_pattern.sub(f"version={version}", ini_data)
arduino_meta_file.write_text(ini_data, encoding="utf-8", newline="\n")
made_changes = True

return made_changes
Expand Down
1 change: 1 addition & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git-cliff==2.10.1
2 changes: 1 addition & 1 deletion .github/workflows/arduino_size_deltas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
pattern: arduino-deltas-*
path: ${{ inputs.reports-path }}

- uses: 2bndy5/arduino-report-size-deltas@v1
- uses: 2bndy5/arduino-report-size-deltas@5d226f8792e1cca65534f3697748af289138af25 # v1.0.4
with:
sketches-reports-source: ${{ inputs.reports-path }}
12 changes: 8 additions & 4 deletions .github/workflows/build_arduino.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
- source-url: https://github.com/<owner>/<repo>.git
version: <branch_name>
```
Otherwise, just the lib's name in the Arduino Lib Manager will suffic:
Otherwise, just the lib's name in the Arduino Lib Manager will suffice:
```yml
- source-url: https://github.com/nRF24/RF24Network.git
version: master
Expand Down Expand Up @@ -73,15 +73,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false

- name: sketch reports
- name: Delta reports' artifact name
if: inputs.enable-deltas-report
id: delta-report-name
env:
FQBN: ${{ inputs.fqbn }}
run: >-
echo "report-name=${{ inputs.fqbn }}" | tr : - >> "$GITHUB_OUTPUT"
echo "report-name=${FQBN}" | tr : - >> "${GITHUB_OUTPUT}"

- name: Compile examples
uses: arduino/compile-sketches@main
uses: arduino/compile-sketches@8ac27e99289705c4abec832089575d687b859227 # v1.1.2
with:
# cli-version: '0.33.0'
sketch-paths: ${{ inputs.sketch-paths }}
Expand Down
Loading