Skip to content

Commit f1171b4

Browse files
Merge remote-tracking branch 'origin/development' into fix/scheduler-race-cond-part2
2 parents 1c489af + 15c6f75 commit f1171b4

46 files changed

Lines changed: 4410 additions & 1550 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changesets/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changesets
2+
3+
Each pull request targeting `development` must add exactly one file to this directory.
4+
5+
Use this format:
6+
7+
```text
8+
release: patch
9+
summary: Fix scheduler race condition when registering timers
10+
11+
Optional extra context in markdown.
12+
```
13+
14+
Allowed values for `release:` are:
15+
16+
- `major` for breaking API or contract changes
17+
- `minor` for backwards-compatible features
18+
- `patch` for backwards-compatible fixes
19+
- `none` for changes that should wait for the next real release without bumping the version on their own
20+
21+
The release workflows aggregate all pending changesets, calculate the next semantic version, update
22+
`VERSION`, prepend `CHANGELOG.md`, and archive the processed files under `.changesets/archive/`.

.changesets/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
release: patch
2+
summary: Describe the user-visible change in one line
3+
4+
Optional extra context in markdown.

.changesets/adc-dma-minor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
release: minor
2+
summary: Refactor the ADC stack around DMA-backed acquisition using new MPU
3+
4+
Includes the DMA-backed `ADCDomain` migration, the shared ADC sensor base, and the updated ADC integration/tests in the `adc-dma` branch.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
release: none
2+
summary: Introduce semver tooling and release automation infrastructure
3+
4+
Bootstrap the semiautomated release flow for ST-LIB without publishing a new
5+
library version yet.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Changeset Required
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- development
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- ready_for_review
12+
- edited
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
concurrency:
19+
group: release-plan-${{ github.event.pull_request.number }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
changeset-required:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Skip validation for automated release PRs
33+
if: github.head_ref == 'release/next'
34+
run: |
35+
echo "Automated release PR detected; changeset validation is skipped." >> "$GITHUB_STEP_SUMMARY"
36+
37+
- name: Validate PR changeset
38+
if: github.head_ref != 'release/next'
39+
run: |
40+
python3 tools/release.py validate-pr \
41+
--base "${{ github.event.pull_request.base.sha }}" \
42+
--head "${{ github.event.pull_request.head.sha }}"
43+
44+
- name: Build release preview
45+
if: github.head_ref != 'release/next'
46+
run: |
47+
python3 tools/release.py preview --format markdown > .release-plan.md
48+
cat .release-plan.md >> "$GITHUB_STEP_SUMMARY"
49+
50+
- name: Upsert PR comment
51+
if: github.head_ref != 'release/next'
52+
uses: actions/github-script@v7
53+
with:
54+
script: |
55+
const fs = require('fs');
56+
const marker = '<!-- st-lib-release-plan -->';
57+
const body = `${marker}\n${fs.readFileSync('.release-plan.md', 'utf8')}`;
58+
const owner = context.repo.owner;
59+
const repo = context.repo.repo;
60+
const issue_number = context.issue.number;
61+
const comments = await github.paginate(github.rest.issues.listComments, {
62+
owner,
63+
repo,
64+
issue_number,
65+
per_page: 100,
66+
});
67+
const existing = comments.find((comment) => comment.body && comment.body.includes(marker));
68+
if (existing) {
69+
await github.rest.issues.updateComment({
70+
owner,
71+
repo,
72+
comment_id: existing.id,
73+
body,
74+
});
75+
} else {
76+
await github.rest.issues.createComment({
77+
owner,
78+
repo,
79+
issue_number,
80+
body,
81+
});
82+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish Release
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- development
7+
types:
8+
- closed
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
publish-release:
15+
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'release/next' && github.event.pull_request.head.repo.full_name == github.repository
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout merged release commit
20+
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.event.pull_request.merge_commit_sha }}
23+
fetch-depth: 0
24+
25+
- name: Read release version
26+
id: version
27+
run: |
28+
version="$(tr -d '\n' < VERSION)"
29+
echo "version=${version}" >> "$GITHUB_OUTPUT"
30+
echo "tag=v${version}" >> "$GITHUB_OUTPUT"
31+
32+
- name: Export release notes
33+
run: |
34+
python3 tools/release.py latest-notes > .release-notes.md
35+
cat .release-notes.md >> "$GITHUB_STEP_SUMMARY"
36+
37+
- name: Check whether the tag already exists
38+
id: tag
39+
run: |
40+
if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
41+
echo "exists=true" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "exists=false" >> "$GITHUB_OUTPUT"
44+
fi
45+
46+
- name: Create git tag
47+
if: steps.tag.outputs.exists != 'true'
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
51+
git tag "${{ steps.version.outputs.tag }}" "${{ github.event.pull_request.merge_commit_sha }}"
52+
git push origin "${{ steps.version.outputs.tag }}"
53+
54+
- name: Check whether the GitHub release already exists
55+
id: release
56+
env:
57+
GH_TOKEN: ${{ github.token }}
58+
run: |
59+
if gh release view "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
60+
echo "exists=true" >> "$GITHUB_OUTPUT"
61+
else
62+
echo "exists=false" >> "$GITHUB_OUTPUT"
63+
fi
64+
65+
- name: Create GitHub release
66+
if: steps.release.outputs.exists != 'true'
67+
env:
68+
GH_TOKEN: ${{ github.token }}
69+
run: |
70+
prerelease_flag=""
71+
case "${{ steps.version.outputs.version }}" in
72+
*-*)
73+
prerelease_flag="--prerelease"
74+
;;
75+
esac
76+
77+
gh release create "${{ steps.version.outputs.tag }}" \
78+
--title "${{ steps.version.outputs.tag }}" \
79+
--notes-file .release-notes.md \
80+
${prerelease_flag}

.github/workflows/release-pr.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Prepare Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- development
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: release-pr-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
prepare-release-pr:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Compute release state
28+
id: versions
29+
run: |
30+
current_version="$(tr -d '\n' < VERSION)"
31+
next_version="$(python3 tools/release.py next-version)"
32+
echo "current_version=${current_version}" >> "$GITHUB_OUTPUT"
33+
echo "next_version=${next_version}" >> "$GITHUB_OUTPUT"
34+
35+
- name: Skip when nothing releasable is pending
36+
if: steps.versions.outputs.current_version == steps.versions.outputs.next_version
37+
run: |
38+
echo "No releasable changesets are pending."
39+
python3 tools/release.py preview --format markdown >> "$GITHUB_STEP_SUMMARY"
40+
41+
- name: Prepare release branch
42+
if: steps.versions.outputs.current_version != steps.versions.outputs.next_version
43+
id: prepare
44+
run: |
45+
python3 tools/release.py apply --output .release-version
46+
release_version="$(tr -d '\n' < .release-version)"
47+
echo "release_version=${release_version}" >> "$GITHUB_OUTPUT"
48+
49+
git config user.name "github-actions[bot]"
50+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
51+
git switch -C release/next
52+
git add VERSION CHANGELOG.md .changesets
53+
git commit -m "chore(release): prepare v${release_version}"
54+
git push --force --set-upstream origin release/next
55+
56+
- name: Create or update release PR
57+
if: steps.versions.outputs.current_version != steps.versions.outputs.next_version
58+
uses: actions/github-script@v7
59+
env:
60+
RELEASE_VERSION: ${{ steps.prepare.outputs.release_version }}
61+
with:
62+
script: |
63+
const owner = context.repo.owner;
64+
const repo = context.repo.repo;
65+
const head = `${owner}:release/next`;
66+
const base = 'development';
67+
const title = `chore(release): prepare v${process.env.RELEASE_VERSION}`;
68+
const marker = '<!-- st-lib-release-pr -->';
69+
const body = [
70+
marker,
71+
'',
72+
'This PR was prepared automatically from the pending ST-LIB changesets.',
73+
'',
74+
`- Version: \`v${process.env.RELEASE_VERSION}\``,
75+
'- Source of truth: `VERSION`',
76+
'- Release notes source: `CHANGELOG.md`',
77+
].join('\n');
78+
79+
const { data: pulls } = await github.rest.pulls.list({
80+
owner,
81+
repo,
82+
state: 'open',
83+
head,
84+
base,
85+
});
86+
87+
if (pulls.length > 0) {
88+
await github.rest.pulls.update({
89+
owner,
90+
repo,
91+
pull_number: pulls[0].number,
92+
title,
93+
body,
94+
});
95+
} else {
96+
await github.rest.pulls.create({
97+
owner,
98+
repo,
99+
title,
100+
head: 'release/next',
101+
base,
102+
body,
103+
});
104+
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
This file tracks ST-LIB releases prepared by the semiautomated release flow.
4+
The revived semantic-versioning baseline starts at `v5.0.0`.
5+
6+
Historical releases that predate this file remain available in Git tags such as
7+
`v1.0.0`, `v3.0.0`, `v4.0.0-beta`, and `h10`.

CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
cmake_minimum_required(VERSION 3.14)
22

3+
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/VERSION" STLIB_VERSION_FULL LIMIT_COUNT 1)
4+
if(NOT STLIB_VERSION_FULL)
5+
message(FATAL_ERROR "Could not read ST-LIB version from VERSION")
6+
endif()
7+
string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" STLIB_PROJECT_VERSION "${STLIB_VERSION_FULL}")
8+
if(NOT STLIB_PROJECT_VERSION)
9+
message(FATAL_ERROR "VERSION must start with a semantic version core, got: ${STLIB_VERSION_FULL}")
10+
endif()
11+
312
if(DEFINED STLIB_NAME_SUFFIX)
4-
project(ST-LIB-${STLIB_NAME_SUFFIX} C CXX)
13+
project(ST-LIB-${STLIB_NAME_SUFFIX} VERSION ${STLIB_PROJECT_VERSION} LANGUAGES C CXX)
514
set(STLIB_LIBRARY st-lib-${STLIB_NAME_SUFFIX})
615
else()
7-
project(ST-LIB C CXX)
16+
project(ST-LIB VERSION ${STLIB_PROJECT_VERSION} LANGUAGES C CXX)
817
set(STLIB_LIBRARY st-lib)
918
endif()
1019
if(NOT PROJECT_IS_TOP_LEVEL)
@@ -273,7 +282,6 @@ set(HALAL_CPP_NO_ETH
273282
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Models/DMA/DMA2.cpp
274283
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Models/PinModel/Pin.cpp
275284
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Models/TimerDomain/TimerDomain.cpp
276-
# ${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/ADC/ADC.cpp
277285
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/CORDIC/CORDIC.cpp
278286
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Communication/FDCAN/FDCAN.cpp
279287
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Communication/I2C/I2C.cpp
@@ -362,8 +370,6 @@ set(STLIB_LOW_CPP_NO_ETH
362370
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/ST-LIB_LOW.cpp
363371
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/Sd/Sd.cpp
364372
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/Sensors/DigitalSensor/DigitalSensor.cpp
365-
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/Sensors/LookupSensor/LookupSensor.cpp
366-
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/Sensors/NTC/NTC.cpp
367373
${CMAKE_CURRENT_LIST_DIR}/Src/ST-LIB_LOW/Sensors/SensorInterrupt/SensorInterrupt.cpp
368374
)
369375

@@ -424,6 +430,7 @@ add_library(${STLIB_LIBRARY} OBJECT
424430

425431
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Time/Scheduler.cpp>
426432
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Models/TimerDomain/TimerDomain.cpp>
433+
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Models/MPUManager/MPUManager.cpp>
427434
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_hal_adc.cpp>
428435
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_hal_dma.cpp>
429436
$<$<NOT:$<BOOL:${CMAKE_CROSSCOMPILING}>>:${CMAKE_CURRENT_LIST_DIR}/Src/MockedDrivers/mocked_hal_spi.cpp>

Inc/HALAL/HALAL.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "HALAL/Services/Flash/Flash.hpp"
1313
#include "HALAL/Services/Flash/FlashTests/Flash_Test.hpp"
1414

15-
#include "HALAL/Services/ADC/NewADC.hpp"
15+
#include "HALAL/Services/ADC/ADC.hpp"
1616

1717
// To be implemented
1818
// #include "HALAL/Services/PWM/DualPhasedPWM/DualPhasedPWM.hpp"

0 commit comments

Comments
 (0)