Skip to content

Commit b4d9300

Browse files
committed
Add size reports
1 parent 42ea8c2 commit b4d9300

7 files changed

Lines changed: 79 additions & 55 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup size reports
2+
description: Setup size reports
3+
inputs:
4+
gh-context:
5+
description: "GH Context"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Set up environment for size reports
12+
shell: bash
13+
env:
14+
GH_CONTEXT: ${{ inputs.gh-context }}
15+
run: matter_cpp/repo/scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: upload-size-reports
2+
description: upload-size-reports
3+
inputs:
4+
platform-name:
5+
description: "Platform name Name"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Uploading Size Reports
12+
uses: actions/upload-artifact@v4
13+
if: ${{ !env.ACT }}
14+
with:
15+
name: Size,${{ inputs.platform-name }}-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }}
16+
path: |
17+
/tmp/bloat_reports/

.github/workflows/ci.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,34 @@ jobs:
6262
- name: Benchmark
6363
run: cd rs-matter; cargo bench --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},log
6464

65+
- name: Set up environment for size reports
66+
uses: ./.github/actions/setup-size-reports
67+
if: ${{ !env.ACT }}
68+
with:
69+
gh-context: ${{ toJson(github) }}
70+
6571
- name: Test
6672
if: matrix.features == 'os'
6773
run: cd rs-matter; cargo test --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},log
6874

6975
- name: Examples
7076
if: matrix.features == 'os' && matrix.crypto-backend == 'rustcrypto'
71-
run: cargo build --examples --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},log
77+
run: cargo build --examples --release --no-default-features --features ${{matrix.crypto-backend}},${{matrix.features}},log
78+
79+
- name: Prepare bloat report from the previous builds
80+
run: |
81+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
82+
linux rs-matter onoff-light-bt \
83+
target/release/onoff_light_bt \
84+
/tmp/bloat_reports/
85+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
86+
linux rs-matter dimmable_light \
87+
target/release/dimmable_light \
88+
/tmp/bloat_reports/
89+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
90+
linux rs-matter speaker \
91+
target/release/speaker \
92+
/tmp/bloat_reports/
7293
7394
- name: Xtask Fmt
7495
if: matrix.features == 'os' && matrix.crypto-backend == 'rustcrypto'
@@ -77,3 +98,9 @@ jobs:
7798
- name: Xtask Clippy
7899
if: matrix.features == 'os' && matrix.crypto-backend == 'rustcrypto'
79100
run: cd xtask; cargo clippy --no-deps -- -Dwarnings
101+
102+
- name: Uploading Size Reports
103+
uses: ./.github/actions/upload-size-reports
104+
if: ${{ !env.ACT }}
105+
with:
106+
platform-name: linux

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "matter_cpp/repo"]
2+
path = matter_cpp/repo
3+
url = https://github.com/project-chip/connectedhomeip.git
4+
branch = v1.3-branch

xtask/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ From the rs-matter root directory:
99
```bash
1010
cargo xtask --help
1111
```
12+
13+
To get necessary environment configs (such as `gn`), you may also need to run:
14+
```base
15+
source matter_cpp/repo/scripts/bootstrap.sh
16+
```

xtask/src/itest.rs

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ const DEFAULT_TESTS: &[&str] = &[
4343
"TestCommissioningWindow",
4444
];
4545

46-
/// The default Git reference to use for the Chip repository
47-
pub const CHIP_DEFAULT_GITREF: &str = "v1.3.0.0"; //"master";
4846
/// The directory where the Chip repository will be cloned
49-
const CHIP_DIR: &str = ".build/itest/connectedhomeip";
47+
const CHIP_DIR: &str = "matter_cpp/repo";
5048

5149
/// The tooling that is checked for presence in the command line
5250
const REQUIRED_TOOLING: &[&str] = &[
@@ -138,8 +136,8 @@ impl ITests {
138136
/// - Clone the Chip repo if it doesn't exist, or updates it if it does
139137
/// - Activate the Chip environment
140138
/// - Build `chip-tool`
141-
pub fn setup(&self, chip_gitref: Option<&str>, force_rebuild: bool) -> anyhow::Result<()> {
142-
self.setup_chip_tool(chip_gitref, force_rebuild)
139+
pub fn setup(&self, force_rebuild: bool) -> anyhow::Result<()> {
140+
self.setup_chip_tool(force_rebuild)
143141
}
144142

145143
/// Build the executable (`chip-tool-tests`) that is to be tested with the Chip integration tests.
@@ -166,64 +164,25 @@ impl ITests {
166164

167165
fn setup_chip_tool(
168166
&self,
169-
chip_gitref: Option<&str>,
170167
force_rebuild: bool,
171168
) -> anyhow::Result<()> {
172169
warn!("Setting up Chip environment...");
173170

174171
let chip_dir = self.workspace_dir.join(CHIP_DIR);
175-
let chip_gitref = chip_gitref.unwrap_or(CHIP_DEFAULT_GITREF);
176172

177173
// Check system dependencies
178174
self.check_tooling()?;
179175

180-
// Clone or update Chip repository
181-
if !chip_dir.exists() {
182-
info!("Cloning Chip repository...");
183-
184-
// Ensure parent directories exist
185-
if let Some(parent) = chip_dir.parent() {
186-
fs::create_dir_all(parent)
187-
.context("Failed to create parent directories for Chip")?;
188-
}
189-
190-
let mut cmd = Command::new("git");
191-
192-
cmd.arg("clone")
193-
.arg("https://github.com/project-chip/connectedhomeip.git")
194-
.arg(&chip_dir);
195-
196-
if !self.print_cmd_output {
197-
cmd.arg("--quiet");
198-
}
199-
200-
self.run_command(&mut cmd)?;
201-
} else {
202-
info!("Chip repository already exists");
203-
204-
if force_rebuild {
205-
info!("Force rebuild requested, cleaning build artifacts...");
176+
if force_rebuild {
177+
info!("Force rebuild requested, cleaning build artifacts...");
206178

207-
let out_dir = chip_dir.join("out");
208-
if out_dir.exists() {
209-
fs::remove_dir_all(&out_dir)
210-
.context("Failed to remove existing out directory")?;
211-
}
179+
let out_dir = chip_dir.join("out");
180+
if out_dir.exists() {
181+
fs::remove_dir_all(&out_dir)
182+
.context("Failed to remove existing out directory")?;
212183
}
213184
}
214185

215-
// Checkout the specified reference
216-
info!("Checking out Chip GIT reference: {chip_gitref}...");
217-
218-
let mut cmd = Command::new("git");
219-
220-
cmd.current_dir(&chip_dir).arg("checkout").arg(chip_gitref);
221-
222-
if !self.print_cmd_output {
223-
cmd.arg("--quiet");
224-
}
225-
226-
self.run_command(&mut cmd)?;
227186

228187
// Detect host platform for selective submodule initialization
229188
let platform = self.host_platform()?;

xtask/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Command {
9595
ITests::new(workspace_dir(), print_cmd_output).print_packages()
9696
}
9797
Command::ItestSetup(args) => ITests::new(workspace_dir(), print_cmd_output)
98-
.setup(Some(&args.gitref), args.force_setup),
98+
.setup(args.force_setup),
9999
Command::ItestExe(args) => ITests::new(workspace_dir(), print_cmd_output).build(
100100
&args.profile,
101101
&args.target,
@@ -171,9 +171,6 @@ impl Verbosity {
171171
/// Arguments for the `itest-setup` command
172172
#[derive(Parser, Debug, Clone)]
173173
struct ItestSetupArgs {
174-
/// Chip repository reference (branch/tag/commit)
175-
#[arg(long, default_value = itest::CHIP_DEFAULT_GITREF)]
176-
gitref: String,
177174
/// Force setup even if cached
178175
#[arg(long)]
179176
force_setup: bool,

0 commit comments

Comments
 (0)