Skip to content

Commit e75b5fc

Browse files
authored
Merge branch 'main' into feature/document-generation
2 parents c8df85b + 239fe97 commit e75b5fc

33 files changed

+320
-205
lines changed

.devcontainer/cpp/Dockerfile

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
FROM ubuntu:24.04@sha256:9cbed754112939e914291337b5e554b07ad7c392491dba6daf25eef1332a22e8
1+
# syntax=docker/dockerfile:1
22

3-
ARG BATS_VERSION=1.11.0
4-
ARG CCACHE_VERSION=4.11
3+
FROM ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc AS extractor
4+
5+
ARG BATS_CORE_VERSION=1.12.0
6+
ARG BATS_SUPPORT_VERSION=0.3.0
7+
ARG BATS_ASSERT_VERSION=2.1.0
8+
9+
ADD --checksum=sha256:e36b020436228262731e3319ed013d84fcd7c4bd97a1b34dee33d170e9ae6bab \
10+
https://github.com/bats-core/bats-core/archive/refs/tags/v${BATS_CORE_VERSION}.tar.gz /bats-core.tar.gz
11+
ADD --checksum=sha256:7815237aafeb42ddcc1b8c698fc5808026d33317d8701d5ec2396e9634e2918f \
12+
https://github.com/bats-core/bats-support/archive/refs/tags/v${BATS_SUPPORT_VERSION}.tar.gz /bats-support.tar.gz
13+
ADD --checksum=sha256:98ca3b685f8b8993e48ec057565e6e2abcc541034ed5b0e81f191505682037fd \
14+
https://github.com/bats-core/bats-assert/archive/refs/tags/v2.1.0.tar.gz /bats-assert.tar.gz
15+
16+
RUN tar xzf /bats-core.tar.gz && mv bats-core-*/ bats-core \
17+
&& tar xzf /bats-support.tar.gz && mv bats-support-*/ bats-support \
18+
&& tar xzf /bats-assert.tar.gz && mv bats-assert-*/ bats-assert
19+
20+
FROM ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc
21+
22+
ARG CCACHE_VERSION=4.12
523
ARG CLANG_VERSION=18
624
ARG CPM_VERSION=0.40.2
725
ARG INCLUDE_WHAT_YOU_USE_VERSION=0.22
8-
ARG XWIN_VERSION=0.6.5
26+
ARG XWIN_VERSION=0.6.7
927

1028
ARG DEBIAN_FRONTEND=noninteractive
1129

@@ -46,7 +64,6 @@ RUN --mount=type=bind,source=.devcontainer/cpp/apt-requirements-clang.json,targe
4664
--mount=type=cache,target=/var/cache/apt,sharing=locked \
4765
--mount=type=cache,target=/var/lib/apt,sharing=locked \
4866
--mount=type=cache,target=/var/log,sharing=locked \
49-
--mount=type=cache,target=/tmp,sharing=locked,mode=1777 \
5067
wget --no-hsts -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm-snapshot-keyring.gpg \
5168
&& wget --no-hsts -qO - https://dl.cloudsmith.io/public/mull-project/mull-stable/gpg.41DB35380DE6BD6F.key | gpg --dearmor -o /usr/share/keyrings/mull-project-mull-stable-archive-keyring.gpg \
5269
&& UBUNTU_CODENAME=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d= -f2) \
@@ -61,23 +78,14 @@ RUN mkdir /opt/gcc-arm-none-eabi \
6178
&& wget --no-hsts -qO - "https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-$(uname -m)-arm-none-eabi.tar.xz" | tar --exclude='*arm-none-eabi-gdb*' --exclude='share' --strip-components=1 -xJC /opt/gcc-arm-none-eabi
6279

6380
# Install bats
64-
RUN batstmp="$(mktemp -d /tmp/bats-core-${BATS_VERSION}.XXXX)" \
65-
&& wget --no-hsts -qO - https://github.com/bats-core/bats-core/archive/refs/tags/v${BATS_VERSION}.tar.gz | tar xz -C "${batstmp}" \
66-
&& bash "${batstmp}/bats-core-${BATS_VERSION}/install.sh" /usr/local \
67-
&& rm -rf "${batstmp}" \
68-
&& git -C /usr/local clone -b v0.3.0 https://github.com/bats-core/bats-support.git \
69-
&& git -C /usr/local clone -b v2.1.0 https://github.com/bats-core/bats-assert.git
70-
71-
# Install xwin
72-
RUN wget --no-hsts -qO - "https://github.com/Jake-Shadle/xwin/releases/download/${XWIN_VERSION}/xwin-${XWIN_VERSION}-$(uname -m)-unknown-linux-musl.tar.gz" | tar -xzv -C /usr/local/bin --strip-components=1 "xwin-${XWIN_VERSION}-$(uname -m)-unknown-linux-musl/xwin"
73-
74-
# Compile and install additional clang tools; often necessary as binary arm64 builds are lacking, or packages are out-of-date
75-
# Install ccache from source for a recent version
76-
RUN --mount=type=cache,target=/cache,sharing=locked \
77-
wget --no-hsts -qO - https://github.com/ccache/ccache/archive/refs/tags/v${CCACHE_VERSION}.tar.gz | tar xz -C /tmp \
78-
&& CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=Off -DENABLE_DOCUMENTATION=Off -S /tmp/ccache-${CCACHE_VERSION} -B /tmp/ccache-${CCACHE_VERSION}/build \
79-
&& cmake --build /tmp/ccache-${CCACHE_VERSION}/build --target install \
80-
&& rm -rf /tmp/ccache-${CCACHE_VERSION}
81+
RUN --mount=from=extractor,target=/src \
82+
bash /src/bats-core/install.sh /usr/local \
83+
&& cp -r /src/bats-support /usr/local/bats-support \
84+
&& cp -r /src/bats-assert /usr/local/bats-assert
85+
86+
# Install xwin and ccache
87+
RUN wget --no-hsts -qO - "https://github.com/Jake-Shadle/xwin/releases/download/${XWIN_VERSION}/xwin-${XWIN_VERSION}-$(uname -m)-unknown-linux-musl.tar.gz" | tar -xzv -C /usr/local/bin --strip-components=1 "xwin-${XWIN_VERSION}-$(uname -m)-unknown-linux-musl/xwin" \
88+
&& wget --no-hsts -qO - "https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-$(uname -m).tar.xz" | tar -xJ -C /usr/local/bin --strip-components=1 "ccache-${CCACHE_VERSION}-linux-$(uname -m)/ccache"
8189

8290
# Install include-what-you-use (iwyu) from source
8391
# hadolint ignore=DL3008

.devcontainer/cpp/apt-requirements-base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"git": "1:2.43.0-1ubuntu7.3",
77
"gnupg2": "2.4.4-2ubuntu17.3",
88
"ninja-build": "1.11.1-2",
9-
"python3-pip": "24.0+dfsg-1ubuntu1.2",
9+
"python3-pip": "24.0+dfsg-1ubuntu1.3",
1010
"udev": "255.4-1ubuntu8.10",
1111
"unzip": "6.0-28ubuntu4.1",
1212
"wget": "1.21.4-1ubuntu4.1",

.devcontainer/cpp/devcontainer-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"resolved": "ghcr.io/devcontainers/features/desktop-lite@sha256:8247ef1d9058f79e86bfe17e26c2688ac3acd726ec2966e20f19173838896983",
66
"integrity": "sha256:8247ef1d9058f79e86bfe17e26c2688ac3acd726ec2966e20f19173838896983"
77
},
8-
"ghcr.io/devcontainers/features/github-cli:1": {
9-
"version": "1.0.14",
10-
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:ca677566507c4118e4368cd76a4800807e911e5e350cc3525fb67ebc9132dfa1",
11-
"integrity": "sha256:ca677566507c4118e4368cd76a4800807e911e5e350cc3525fb67ebc9132dfa1"
8+
"ghcr.io/devcontainers/features/github-cli:": {
9+
"version": "1.0.15",
10+
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:1ad1ec1a806cc9926c84ca5b147427bba03b97e14e91f9df89af83726039ecaf",
11+
"integrity": "sha256:1ad1ec1a806cc9926c84ca5b147427bba03b97e14e91f9df89af83726039ecaf"
1212
},
1313
"ghcr.io/devcontainers/features/node:1": {
1414
"version": "1.6.3",

.devcontainer/cpp/devcontainer-metadata-vscode.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
1010
1111
12-
"ms-vscode.cpptools@1.26.3",
12+
"ms-vscode.cpptools@1.27.7",
1313
14-
"sonarsource.sonarlint-vscode@4.30.0"
14+
"sonarsource.sonarlint-vscode@4.31.0"
1515
],
1616
"settings": {
1717
"C_Cpp.intelliSenseEngine": "disabled",

.devcontainer/cpp/devcontainer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"features": {
1414
"ghcr.io/devcontainers/features/desktop-lite:": {},
15-
"ghcr.io/devcontainers/features/github-cli:1": {},
15+
"ghcr.io/devcontainers/features/github-cli:": {},
1616
"ghcr.io/devcontainers/features/node:1": {}
1717
},
1818
"postCreateCommand": "npm install && npx playwright install --with-deps",
@@ -31,17 +31,17 @@
3131
},
3232
"extensions": [
3333
34-
"github.copilot@1.364.0",
34+
"github.copilot@1.372.0",
3535
36-
"github.vscode-pull-request-github@0.116.2",
36+
"github.vscode-pull-request-github@0.118.1",
3737
3838
3939
4040
4141
4242
43-
"ms-vscode.cpptools@1.26.3",
44-
"sonarsource.sonarlint-vscode@4.30.0",
43+
"ms-vscode.cpptools@1.27.7",
44+
"sonarsource.sonarlint-vscode@4.31.0",
4545
4646
]
4747
}

.devcontainer/rust/Dockerfile

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
FROM ubuntu:24.04@sha256:9cbed754112939e914291337b5e554b07ad7c392491dba6daf25eef1332a22e8
1+
# syntax=docker/dockerfile:1
2+
3+
FROM ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc AS extractor
4+
5+
ARG BATS_CORE_VERSION=1.12.0
6+
ARG BATS_SUPPORT_VERSION=0.3.0
7+
ARG BATS_ASSERT_VERSION=2.1.0
8+
9+
ADD --checksum=sha256:e36b020436228262731e3319ed013d84fcd7c4bd97a1b34dee33d170e9ae6bab \
10+
https://github.com/bats-core/bats-core/archive/refs/tags/v${BATS_CORE_VERSION}.tar.gz /bats-core.tar.gz
11+
ADD --checksum=sha256:7815237aafeb42ddcc1b8c698fc5808026d33317d8701d5ec2396e9634e2918f \
12+
https://github.com/bats-core/bats-support/archive/refs/tags/v${BATS_SUPPORT_VERSION}.tar.gz /bats-support.tar.gz
13+
ADD --checksum=sha256:98ca3b685f8b8993e48ec057565e6e2abcc541034ed5b0e81f191505682037fd \
14+
https://github.com/bats-core/bats-assert/archive/refs/tags/v2.1.0.tar.gz /bats-assert.tar.gz
15+
16+
RUN tar xzf /bats-core.tar.gz && mv bats-core-*/ bats-core \
17+
&& tar xzf /bats-support.tar.gz && mv bats-support-*/ bats-support \
18+
&& tar xzf /bats-assert.tar.gz && mv bats-assert-*/ bats-assert
19+
20+
FROM ubuntu:24.04@sha256:353675e2a41babd526e2b837d7ec780c2a05bca0164f7ea5dbbd433d21d166fc
221

3-
ARG BATS_VERSION=1.11.0
422
ARG CARGO_BINSTALL_VERSION=1.15.1
523
ARG RUST_VERSION=1.89.0
624

@@ -35,12 +53,10 @@ RUN rustup set profile minimal \
3553
&& rustup target add thumbv7em-none-eabihf
3654

3755
# Install bats
38-
RUN batstmp="$(mktemp -d /tmp/bats-core-${BATS_VERSION}.XXXX)" \
39-
&& wget -qO - "https://github.com/bats-core/bats-core/archive/refs/tags/v${BATS_VERSION}.tar.gz" | tar xz -C "${batstmp}" \
40-
&& bash "${batstmp}/bats-core-${BATS_VERSION}/install.sh" /usr/local \
41-
&& rm -rf "${batstmp}" \
42-
&& git -C /usr/local clone -b v0.3.0 https://github.com/bats-core/bats-support.git \
43-
&& git -C /usr/local clone -b v2.1.0 https://github.com/bats-core/bats-assert.git
56+
RUN --mount=from=extractor,target=/src \
57+
bash /src/bats-core/install.sh /usr/local \
58+
&& cp -r /src/bats-support /usr/local/bats-support \
59+
&& cp -r /src/bats-assert /usr/local/bats-assert
4460

4561
# Update all tool alternatives to the correct version
4662
# and patch root's bashrc to include bash-completion

.devcontainer/rust/apt-requirements-base.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"g++-14": "14.2.0-4ubuntu2~24.04",
55
"git": "1:2.43.0-1ubuntu7.3",
66
"gnupg2": "2.4.4-2ubuntu17.3",
7-
"libc6-dev": "2.39-0ubuntu8.5",
87
"rustup": "1.26.0-5build1",
98
"udev": "255.4-1ubuntu8.10",
109
"wget": "1.21.4-1ubuntu4.1",

.devcontainer/rust/devcontainer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
"files.trimTrailingWhitespace": true
1515
},
1616
"extensions": [
17-
"github.copilot@1.208.0",
18-
"github.vscode-github-actions@0.26.3",
19-
"github.vscode-pull-request-github@0.90.0",
17+
"github.copilot@1.372.0",
18+
"github.vscode-github-actions@0.27.2",
19+
"github.vscode-pull-request-github@0.118.1",
2020
2121
2222
23-
"ms-azuretools.vscode-docker@1.29.1",
24-
25-
"sonarsource.sonarlint-vscode@4.7.0",
26-
"tamasfe.even-better-toml@0.19.2",
27-
"usernamehw.errorlens@3.20.0"
23+
"ms-azuretools.vscode-docker@2.0.0",
24+
25+
"sonarsource.sonarlint-vscode@4.31.0",
26+
"tamasfe.even-better-toml@0.21.2",
27+
"usernamehw.errorlens@3.26.0"
2828
]
2929
}
3030
}

.github/RELEASE_TEMPLATE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#### :bookmark: Packages
1010

11-
| Container | Full identifier |
12-
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|
13-
| amp-devcontainer-cpp | ghcr.io/philips-software/amp-devcontainer-cpp:{{ amp-devcontainer-cpp-version }}@sha256:{{ amp-devcontainer-cpp-sha }} |
14-
| amp-devcontainer-rust | ghcr.io/philips-software/amp-devcontainer-rust:{{ amp-devcontainer-rust-version }}@sha256:{{ amp-devcontainer-rust-sha }} |
11+
| Container | Full identifier |
12+
|-----------------------|--------------------------------------------------------------------------------------------------------------------|
13+
| amp-devcontainer-cpp | ghcr.io/philips-software/amp-devcontainer-cpp:{{ amp-devcontainer-cpp-version }}@{{ amp-devcontainer-cpp-sha }} |
14+
| amp-devcontainer-rust | ghcr.io/philips-software/amp-devcontainer-rust:{{ amp-devcontainer-rust-version }}@{{ amp-devcontainer-rust-sha }} |
1515

.github/actions/container-size-diff/action.yml

Lines changed: 113 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,118 @@ runs:
1919
using: "composite"
2020
steps:
2121
- run: |
22-
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
23-
echo "markdown<<${EOF}" >> "${GITHUB_OUTPUT}"
24-
echo "$(${GITHUB_ACTION_PATH}/container-size-diff.sh ${INPUT_FROM_CONTAINER} ${INPUT_TO_CONTAINER})" >> "${GITHUB_OUTPUT}"
25-
echo "${EOF}" >> "${GITHUB_OUTPUT}"
26-
id: size-diff
22+
cat > package.json << 'EOF'
23+
{
24+
"dependencies": {
25+
"execa": "^9.6.0",
26+
"filesize": "^11.0.2",
27+
"lodash": "^4.0.0",
28+
"markdown-table": "^3.0.4"
29+
}
30+
}
31+
EOF
32+
shell: bash
33+
34+
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
35+
with:
36+
cache: npm
37+
cache-dependency-path: package.json
38+
node-version: 22.x
39+
40+
- run: npm install
2741
shell: bash
42+
43+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
44+
id: size-diff
2845
env:
29-
INPUT_FROM_CONTAINER: ${{ inputs.from-container }}
30-
INPUT_TO_CONTAINER: ${{ inputs.to-container }}
46+
FROM_CONTAINER: ${{ inputs.from-container }}
47+
TO_CONTAINER: ${{ inputs.to-container }}
48+
with:
49+
script: |
50+
const { execaSync } = require("execa");
51+
const { filesize } = require("filesize");
52+
const { markdownTable } = require("markdown-table");
53+
const _ = require("lodash");
54+
55+
const fromContainer = process.env.FROM_CONTAINER;
56+
const toContainer = process.env.TO_CONTAINER;
57+
58+
async function getSizes(container) {
59+
try {
60+
const { stdout } = execaSync("docker", ["manifest", "inspect", "-v", container]);
61+
const manifests = _.castArray(JSON.parse(stdout.trim()));
62+
63+
return _(manifests)
64+
.map(m => {
65+
const platform = _.get(m, 'Descriptor.platform', {});
66+
67+
const key = _.compact([
68+
platform.os,
69+
platform.architecture,
70+
platform.variant,
71+
platform["os.version"]
72+
])
73+
.join("/");
74+
75+
const layers = _.get(m, 'OCIManifest.layers') || _.get(m, 'layers', []);
76+
const total = _.sumBy(layers, 'size');
77+
78+
return [key, total];
79+
})
80+
.fromPairs()
81+
.value();
82+
} catch (e) {
83+
core.error(`Failed to inspect ${container}: ${e.message}`);
84+
return {};
85+
}
86+
}
87+
88+
const fromSizes = await getSizes(fromContainer);
89+
const toSizes = await getSizes(toContainer);
90+
91+
const platforms = _(fromSizes)
92+
.keys()
93+
.union(_.keys(toSizes))
94+
.filter(platform => platform && !platform.includes("unknown"))
95+
.sort()
96+
.value();
97+
98+
const platformRow = (platform) => {
99+
const previous = _.get(fromSizes, platform, 0);
100+
const current = _.get(toSizes, platform, 0);
101+
const change = current - previous;
102+
103+
const percentage = previous
104+
? `${change >= 0 ? "+" : ""}${_.round(change / previous * 100, 2)}%`
105+
: current ? "+∞" : "+0.00%";
106+
107+
const icon = _.cond([
108+
[change => change < 0, _.constant("🔽")],
109+
[change => change > 0, _.constant("🔼")],
110+
[_.stubTrue, _.constant("🔄")]
111+
])(change);
112+
113+
return [
114+
platform,
115+
filesize(previous),
116+
filesize(current),
117+
`${change >= 0 ? "+" : ""}${filesize(Math.abs(change))} (${percentage})`,
118+
icon
119+
];
120+
};
121+
122+
const rows = [
123+
["OS/Platform", "Previous", "Current", "Change", "Trend"],
124+
..._.map(platforms, platformRow)
125+
];
126+
127+
const output = `## 📦 Container Size Analysis
128+
129+
> [!NOTE]
130+
> Comparing \`${fromContainer}\` ➔ \`${toContainer}\`
131+
132+
### 📈 Size Comparison Table
133+
134+
${markdownTable(rows, { align: ["l", "c", "c", "c", "c"] })}`;
135+
136+
core.setOutput("markdown", output);

0 commit comments

Comments
 (0)