Skip to content

Commit 65f25fa

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

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
@@ -46,6 +46,18 @@ jobs:
4646
component: supervisor
4747
platform: linux/arm64
4848

49+
build-cli:
50+
needs: [pr_metadata]
51+
if: needs.pr_metadata.outputs.should_run == 'true'
52+
permissions:
53+
contents: read
54+
packages: read
55+
uses: ./.github/workflows/docker-build.yml
56+
with:
57+
component: cli
58+
platform: linux/amd64
59+
secrets: inherit
60+
4961
e2e:
5062
needs: [pr_metadata, build-gateway, build-supervisor]
5163
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:
@@ -66,6 +66,8 @@ jobs:
6666
binary_name: ${{ steps.resolve.outputs.binary_name }}
6767
artifact_prefix: ${{ steps.resolve.outputs.artifact_prefix }}
6868
image_tag_base: ${{ steps.resolve.outputs.image_tag_base }}
69+
features: ${{ steps.resolve.outputs.features }}
70+
has_image: ${{ steps.resolve.outputs.has_image }}
6971
steps:
7072
- name: Resolve component and platform matrix
7173
id: resolve
@@ -77,10 +79,20 @@ jobs:
7779
gateway)
7880
binary_component=gateway
7981
binary_name=openshell-gateway
82+
features="openshell-core/dev-settings"
83+
has_image=true
8084
;;
8185
supervisor)
8286
binary_component=sandbox
8387
binary_name=openshell-sandbox
88+
features="openshell-core/dev-settings"
89+
has_image=true
90+
;;
91+
cli)
92+
binary_component=cli
93+
binary_name=openshell
94+
features="bundled-z3"
95+
has_image=false
8496
;;
8597
*)
8698
echo "unsupported component: $component" >&2
@@ -139,6 +151,8 @@ jobs:
139151
echo "binary_name=$binary_name"
140152
echo "artifact_prefix=rust-binary-${component}-${binary_component}"
141153
echo "image_tag_base=$image_tag_base"
154+
echo "features=$features"
155+
echo "has_image=$has_image"
142156
} >> "$GITHUB_OUTPUT"
143157
144158
rust-binary:
@@ -157,13 +171,14 @@ jobs:
157171
cargo-version: ${{ inputs['cargo-version'] }}
158172
image-tag: ${{ needs.resolve.outputs.image_tag_base }}
159173
checkout-ref: ${{ inputs['checkout-ref'] }}
160-
features: openshell-core/dev-settings
174+
features: ${{ needs.resolve.outputs.features }}
161175
artifact-name: ${{ needs.resolve.outputs.artifact_prefix }}-linux-${{ matrix.arch }}
162176
secrets: inherit
163177

164178
build:
165179
name: Build ${{ inputs.component }} (${{ matrix.arch }})
166180
needs: [resolve, rust-binary]
181+
if: needs.resolve.outputs.has_image == 'true'
167182
runs-on: ${{ matrix.runner }}
168183
timeout-minutes: ${{ inputs['timeout-minutes'] }}
169184
strategy:
@@ -257,7 +272,7 @@ jobs:
257272
merge:
258273
name: Merge ${{ inputs.component }} manifest
259274
needs: [resolve, build]
260-
if: ${{ inputs.push && needs.resolve.outputs.platform_count != '1' }}
275+
if: ${{ inputs.push && needs.resolve.outputs.platform_count != '1' && needs.resolve.outputs.has_image == 'true' }}
261276
runs-on: linux-amd64-cpu8
262277
timeout-minutes: 10
263278
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)