Skip to content

Commit e730ebf

Browse files
authored
Merge pull request #371 from tropicsquare/develop
Release 3.0.0
2 parents 15f4b3c + 8057429 commit e730ebf

File tree

199 files changed

+97160
-2834
lines changed

Some content is hidden

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

199 files changed

+97160
-2834
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ BreakBeforeBraces: Stroustrup
1010

1111
IndentWidth: 4
1212

13+
PointerAlignment: Right
14+
1315
# # Insert New line at EOF if missing
1416
#InsertNewlineAtEOF: true
1517
# # Set EOL to LF unconditionally

.github/pull_request_template.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Description
2+
3+
Please provide a clear and concise description of the changes introduced by this PR.
4+
Explain the motivation and the context — e.g., bug fix, feature addition, code refactoring, or documentation improvement.
5+
6+
If applicable, reference related issues or tickets (e.g., `Fixes #123`).
7+
8+
---
9+
10+
## Type of Change
11+
12+
Select the type(s) that best describe your change:
13+
14+
- [ ] 🐛 Bug fix
15+
- [ ] ✨ New feature
16+
- [ ] 🧹 Code cleanup or refactoring
17+
- [ ] 📝 Documentation update
18+
- [ ] 🔧 Build system or toolchain update
19+
- [ ] 🔒 Security improvement
20+
- [ ] Other (please describe):
21+
22+
---
23+
24+
## Checklist
25+
26+
Before submitting, please confirm that you have completed the following:
27+
28+
- [ ] I opened the Pull Request to the **develop** branch
29+
- [ ] I followed the project's [**code guidelines**](https://github.com/tropicsquare/libtropic/blob/develop/CONTRIBUTING.md)
30+
- [ ] I formatted the code using **clang-format** with the [recommended configuration](https://github.com/tropicsquare/libtropic/blob/develop/CONTRIBUTING.md)
31+
- [ ] I updated the [**changelog**](https://github.com/tropicsquare/libtropic/blob/develop/CHANGELOG.md), or this change does not require it (e.g., internal or non-functional update)
32+
- [ ] The project **builds without errors or warnings**
33+
- [ ] I have **verified the functionality against the hardware/model** as applicable
34+
- [ ] I have ensured that public APIs remain backward compatible (if applicable)
35+
- [ ] This PR is ready for review by maintainers (no WIP commits left) and marked as Ready for Review
36+
37+
---
38+
39+
## Optional Checks
40+
You can enable optional CI jobs by checking following boxes. For example, coverage job is useful when modifying or implementing new tests.
41+
42+
- [ ] Measure Test Coverage
43+
44+
---
45+
46+
## Notes for Reviewers
47+
48+
(Optional) Add any additional context, known limitations, or areas you'd like reviewers to focus on. If not applicable, you can delete this section.

.github/workflows/coverage.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Run tests against TROPIC01 model and measure coverage
2+
on:
3+
pull_request:
4+
branches:
5+
- 'master'
6+
- 'develop'
7+
8+
jobs:
9+
check_if_enabled:
10+
name: Check if coverage collection is enabled
11+
runs-on: ubuntu-latest
12+
outputs:
13+
should_run: ${{ steps.check.outputs.should_run }}
14+
steps:
15+
- name: Check PR body for trigger string
16+
id: check
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const trigger = "- [x] Measure Test Coverage";
21+
const prBody = context.payload.pull_request.body || "";
22+
core.info(`PR body: ${prBody}`)
23+
const should_run = prBody.includes(trigger) ? true : false
24+
core.info(`Should run: ${should_run}`)
25+
core.setOutput("should_run", should_run);
26+
27+
measure_coverage:
28+
name: Get test coverage
29+
needs: check_if_enabled
30+
if: ${{ needs.check_if_enabled.outputs.should_run == 'true' }}
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4.1.7
35+
with:
36+
submodules: recursive
37+
38+
- name: Setup Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: '3.12'
42+
43+
- name: Download ts-tvl wheel
44+
run: |
45+
curl -s "https://api.github.com/repos/tropicsquare/ts-tvl/releases/tags/2.3" > release.json
46+
47+
WHEEL_URL=$(jq -r '.assets[] | select(.name | endswith(".whl")) | .browser_download_url' release.json)
48+
if [ -z "$WHEEL_URL" ]; then
49+
echo "No .whl file found in the release." >&2
50+
exit 1
51+
fi
52+
53+
WHEEL_FILE_NAME=$(basename "$WHEEL_URL")
54+
echo "WHEEL_FILE_NAME=$WHEEL_FILE_NAME" >> $GITHUB_ENV
55+
curl -L -o "$WHEEL_FILE_NAME" "$WHEEL_URL"
56+
57+
- name: Install dependencies
58+
run: |
59+
sudo apt-get install cmake build-essential
60+
pip install ${{ env.WHEEL_FILE_NAME }}
61+
pip install gcovr jsonschema
62+
63+
- name: Compile libtropic with tests and coverage enabled
64+
run: |
65+
cd tropic01_model/
66+
cmake ./ -B build -DLT_CAL=mbedtls_v4 -DLT_BUILD_TESTS=1 -DLT_TEST_COVERAGE=1
67+
cd build/
68+
make
69+
70+
- name: Execute tests with CTest
71+
run: |
72+
cd tropic01_model/build/
73+
ctest -V
74+
75+
- name: Export Markdown report
76+
run: |
77+
cd tropic01_model
78+
gcovr --markdown coverage_report.md --exclude 'build/_deps/.*|\.\./tests/.*|\.\./vendor/.*'
79+
80+
- name: Post or update PR comment
81+
uses: actions/github-script@v7
82+
with:
83+
script: |
84+
const fs = require("fs");
85+
const path = "tropic01_model/coverage_report.md";
86+
const marker = "<!-- coverage-bot-comment -->";
87+
88+
let commentBody;
89+
try {
90+
const content = fs.readFileSync(path, "utf8");
91+
commentBody = `${marker}\n **Test Coverage Report**\n\n <details><summary>Results</summary>\n\n ${content} </details>`;
92+
} catch (err) {
93+
commentBody = `${marker}\n Could not read coverage file at \`${path}\`.\n\nError: ${err.message}`;
94+
}
95+
96+
const prNumber = context.payload.pull_request.number;
97+
98+
// Fetch all existing comments
99+
const { data: comments } = await github.rest.issues.listComments({
100+
...context.repo,
101+
issue_number: prNumber,
102+
});
103+
104+
// Look for an existing bot comment (with marker)
105+
const existing = comments.find(
106+
c =>
107+
c.user.type === "Bot" &&
108+
c.body &&
109+
c.body.includes(marker)
110+
);
111+
112+
if (existing) {
113+
// Update existing comment
114+
await github.rest.issues.updateComment({
115+
...context.repo,
116+
comment_id: existing.id,
117+
body: commentBody,
118+
});
119+
core.info(`✅ Updated existing coverage comment (#${existing.id}).`);
120+
} else {
121+
// Create new comment
122+
await github.rest.issues.createComment({
123+
...context.repo,
124+
issue_number: prNumber,
125+
body: commentBody,
126+
});
127+
core.info("💬 Created new coverage comment.");
128+
}
129+

.github/workflows/integration_tests.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4.1.7
19+
with:
20+
submodules: recursive
1921

2022
- name: Setup Python
2123
uses: actions/setup-python@v5
@@ -24,11 +26,11 @@ jobs:
2426

2527
- name: Download ts-tvl wheel
2628
run: |
27-
curl -s "https://api.github.com/repos/tropicsquare/ts-tvl/releases/latest" > release.json
29+
curl -s "https://api.github.com/repos/tropicsquare/ts-tvl/releases/tags/2.3" > release.json
2830
2931
WHEEL_URL=$(jq -r '.assets[] | select(.name | endswith(".whl")) | .browser_download_url' release.json)
3032
if [ -z "$WHEEL_URL" ]; then
31-
echo "No .whl file found in latest release." >&2
33+
echo "No .whl file found in the release." >&2
3234
exit 1
3335
fi
3436
@@ -40,11 +42,12 @@ jobs:
4042
run: |
4143
sudo apt-get install cmake build-essential
4244
pip install ${{ env.WHEEL_FILE_NAME }}
45+
pip install jsonschema
4346
4447
- name: Compile libtropic with tests and AddressSanitizer
4548
run: |
4649
cd tropic01_model/
47-
cmake ./ -B build -DLT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DLT_ASAN=1
50+
cmake ./ -B build -DLT_CAL=mbedtls_v4 -DLT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DLT_ASAN=1
4851
cd build/
4952
make
5053
@@ -66,6 +69,8 @@ jobs:
6669
steps:
6770
- name: Checkout repository
6871
uses: actions/checkout@v4.1.7
72+
with:
73+
submodules: recursive
6974

7075
- name: Setup Python
7176
uses: actions/setup-python@v5
@@ -74,11 +79,11 @@ jobs:
7479

7580
- name: Download ts-tvl wheel
7681
run: |
77-
curl -s "https://api.github.com/repos/tropicsquare/ts-tvl/releases/latest" > release.json
82+
curl -s "https://api.github.com/repos/tropicsquare/ts-tvl/releases/tags/2.3" > release.json
7883
7984
WHEEL_URL=$(jq -r '.assets[] | select(.name | endswith(".whl")) | .browser_download_url' release.json)
8085
if [ -z "$WHEEL_URL" ]; then
81-
echo "No .whl file found in latest release." >&2
86+
echo "No .whl file found in the release." >&2
8287
exit 1
8388
fi
8489
@@ -90,11 +95,12 @@ jobs:
9095
run: |
9196
sudo apt-get install cmake build-essential valgrind
9297
pip install ${{ env.WHEEL_FILE_NAME }}
98+
pip install jsonschema
9399
94100
- name: Compile libtropic with tests and Valgrind
95101
run: |
96102
cd tropic01_model/
97-
cmake ./ -B build -DLT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DLT_VALGRIND=1
103+
cmake ./ -B build -DLT_CAL=mbedtls_v4 -DLT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DLT_VALGRIND=1
98104
cd build/
99105
make
100106

.github/workflows/release_new_version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- name: Checkout repository
3636
uses: actions/checkout@v4.1.7
3737
with:
38+
submodules: recursive
3839
fetch-depth: 0 # Ensure full history is available
3940

4041
- name: Get tag

0 commit comments

Comments
 (0)