Skip to content

Commit 05ca53e

Browse files
committed
feat: build CLI during pull request
Fixes #1454 Signed-off-by: Jeff MAURY <jmaury@redhat.com>
1 parent 77e6c7a commit 05ca53e

3 files changed

Lines changed: 46 additions & 8 deletions

File tree

.github/workflows/branch-e2e.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ jobs:
4848
platform: linux/arm64
4949
publish-manifest: false
5050

51+
build-cli:
52+
needs: [pr_metadata]
53+
if: needs.pr_metadata.outputs.should_run == 'true'
54+
permissions:
55+
contents: read
56+
packages: read
57+
uses: ./.github/workflows/docker-build.yml
58+
with:
59+
component: cli
60+
platform: linux/amd64
61+
secrets: inherit
62+
5163
e2e:
5264
needs: [pr_metadata, build-gateway, build-supervisor]
5365
if: needs.pr_metadata.outputs.should_run == 'true'

.github/workflows/docker-build.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55
inputs:
66
component:
7-
description: "Component to build (gateway, supervisor)"
7+
description: "Component to build (gateway, supervisor, cli)"
88
required: true
99
type: string
1010
timeout-minutes:
@@ -71,6 +71,8 @@ jobs:
7171
binary_name: ${{ steps.resolve.outputs.binary_name }}
7272
artifact_prefix: ${{ steps.resolve.outputs.artifact_prefix }}
7373
image_tag_base: ${{ steps.resolve.outputs.image_tag_base }}
74+
features: ${{ steps.resolve.outputs.features }}
75+
has_image: ${{ steps.resolve.outputs.has_image }}
7476
steps:
7577
- name: Resolve component and platform matrix
7678
id: resolve
@@ -82,10 +84,20 @@ jobs:
8284
gateway)
8385
binary_component=gateway
8486
binary_name=openshell-gateway
87+
features="openshell-core/dev-settings"
88+
has_image=true
8589
;;
8690
supervisor)
8791
binary_component=sandbox
8892
binary_name=openshell-sandbox
93+
features="openshell-core/dev-settings"
94+
has_image=true
95+
;;
96+
cli)
97+
binary_component=cli
98+
binary_name=openshell
99+
features="bundled-z3"
100+
has_image=false
89101
;;
90102
*)
91103
echo "unsupported component: $component" >&2
@@ -144,6 +156,8 @@ jobs:
144156
echo "binary_name=$binary_name"
145157
echo "artifact_prefix=rust-binary-${component}-${binary_component}"
146158
echo "image_tag_base=$image_tag_base"
159+
echo "features=$features"
160+
echo "has_image=$has_image"
147161
} >> "$GITHUB_OUTPUT"
148162
149163
rust-binary:
@@ -162,13 +176,14 @@ jobs:
162176
cargo-version: ${{ inputs['cargo-version'] }}
163177
image-tag: ${{ needs.resolve.outputs.image_tag_base }}
164178
checkout-ref: ${{ inputs['checkout-ref'] }}
165-
features: openshell-core/dev-settings
179+
features: ${{ needs.resolve.outputs.features }}
166180
artifact-name: ${{ needs.resolve.outputs.artifact_prefix }}-linux-${{ matrix.arch }}
167181
secrets: inherit
168182

169183
build:
170184
name: Build ${{ inputs.component }} (${{ matrix.arch }})
171185
needs: [resolve, rust-binary]
186+
if: needs.resolve.outputs.has_image == 'true'
172187
runs-on: ${{ matrix.runner }}
173188
timeout-minutes: ${{ inputs['timeout-minutes'] }}
174189
strategy:
@@ -262,7 +277,7 @@ jobs:
262277
merge:
263278
name: Merge ${{ inputs.component }} manifest
264279
needs: [resolve, build]
265-
if: ${{ inputs.push && inputs['publish-manifest'] }}
280+
if: ${{ inputs.push && inputs['publish-manifest'] && needs.resolve.outputs.has_image == 'true' }}
266281
runs-on: linux-amd64-cpu8
267282
timeout-minutes: 10
268283
container:

.github/workflows/rust-native-build.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
name: Rust Image Binary Build (openshell-gateway / openshell-sandbox)
4+
name: Rust Image Binary Build (openshell-gateway / openshell-sandbox / openshell-cli)
55

66
# Build Rust binaries per Linux architecture before the Docker image build
77
# consumes them as prebuilt artifacts. Gateway images use GNU-linked binaries
8-
# for the NVIDIA distroless C/C++ runtime; supervisor images use musl/static
8+
# for the NVIDIA distroless C/C++ runtime; supervisor and cli images use musl/static
99
# binaries so the final image can remain scratch.
1010

1111
on:
1212
workflow_call:
1313
inputs:
1414
component:
15-
description: "Binary component to build (gateway or sandbox)"
15+
description: "Binary component to build (gateway, sandbox, or cli)"
1616
required: true
1717
type: string
1818
arch:
@@ -114,6 +114,11 @@ jobs:
114114
binary=openshell-sandbox
115115
zig_target=
116116
;;
117+
cli)
118+
crate=openshell-cli
119+
binary=openshell
120+
zig_target=
121+
;;
117122
*)
118123
echo "unsupported component: $COMPONENT" >&2
119124
exit 1
@@ -122,15 +127,15 @@ jobs:
122127
123128
case "$ARCH" in
124129
amd64)
125-
if [[ "$COMPONENT" == "sandbox" ]]; then
130+
if [[ "$COMPONENT" == "sandbox" || "$COMPONENT" == "cli" ]]; then
126131
target=x86_64-unknown-linux-musl
127132
zig_target=x86_64-linux-musl
128133
else
129134
target=x86_64-unknown-linux-gnu
130135
fi
131136
;;
132137
arm64)
133-
if [[ "$COMPONENT" == "sandbox" ]]; then
138+
if [[ "$COMPONENT" == "sandbox" || "$COMPONENT" == "cli" ]]; then
134139
target=aarch64-unknown-linux-musl
135140
zig_target=aarch64-linux-musl
136141
else
@@ -202,6 +207,12 @@ jobs:
202207
echo "CARGO_TARGET_${TARGET_ENV_UPPER}_LINKER=/tmp/zig-musl/cc" >> "$GITHUB_ENV"
203208
echo "CARGO_TARGET_${TARGET_ENV_UPPER}_RUSTFLAGS=-Clink-self-contained=no" >> "$GITHUB_ENV"
204209
210+
# z3 built with zig c++ uses libc++ symbols (std::__1::*).
211+
# Override z3-sys default (stdc++) so Rust links the matching runtime.
212+
if [[ "$COMPONENT" == "cli" ]]; then
213+
echo "CXXSTDLIB=c++" >> "$GITHUB_ENV"
214+
fi
215+
205216
- name: Build ${{ steps.target.outputs.binary }} (${{ steps.target.outputs.target }})
206217
env:
207218
# Preserve the release-codegen setting used by the old Dockerfile

0 commit comments

Comments
 (0)