Skip to content

Commit f5e109a

Browse files
feat: build CLI during pull request (#1491)
* feat: build CLI during pull request Fixes #1454 Signed-off-by: Jeff MAURY <jmaury@redhat.com> * fix: removed secrets passing Signed-off-by: Jeff MAURY <jmaury@redhat.com> * fix: fix wrong conflict resolution Signed-off-by: Jeff MAURY <jmaury@redhat.com> * fix: apply suggestion from @TaylorMutch Co-authored-by: Taylor Mutch <taylormutch@gmail.com> * fix: remove doubled quote Signed-off-by: Jeff MAURY <jmaury@redhat.com> * fix: sync mise.lock Signed-off-by: Jeff MAURY <jmaury@redhat.com> --------- Signed-off-by: Jeff MAURY <jmaury@redhat.com> Co-authored-by: Taylor Mutch <taylormutch@gmail.com>
1 parent 234e69d commit f5e109a

4 files changed

Lines changed: 57 additions & 8 deletions

File tree

.github/workflows/branch-e2e.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ jobs:
8080
component: supervisor
8181
image-tag: ${{ github.sha }}
8282

83+
build-cli:
84+
needs: [pr_metadata]
85+
if: needs.pr_metadata.outputs.should_run == 'true'
86+
permissions:
87+
contents: read
88+
packages: write
89+
uses: ./.github/workflows/docker-build.yml
90+
with:
91+
component: cli
92+
platform: linux/amd64
93+
8394
e2e:
8495
needs: [pr_metadata, build-gateway, build-supervisor]
8596
if: needs.pr_metadata.outputs.should_run == 'true' && needs.pr_metadata.outputs.run_core_e2e == '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 bundled-z3"
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: ${{ inputs.component == 'gateway' && 'openshell-core/dev-settings bundled-z3' || '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,11 +1,11 @@
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. Gateway GNU binaries are
1010
# built with an explicit glibc 2.31 floor so image, package, and tarball
1111
# artifacts share the same host portability contract.
@@ -14,7 +14,7 @@ on:
1414
workflow_call:
1515
inputs:
1616
component:
17-
description: "Binary component to build (gateway or sandbox)"
17+
description: "Binary component to build (gateway, sandbox, or cli)"
1818
required: true
1919
type: string
2020
arch:
@@ -121,6 +121,11 @@ jobs:
121121
binary=openshell-sandbox
122122
zig_target=
123123
;;
124+
cli)
125+
crate=openshell-cli
126+
binary=openshell
127+
zig_target=
128+
;;
124129
*)
125130
echo "unsupported component: $COMPONENT" >&2
126131
exit 1
@@ -129,7 +134,7 @@ jobs:
129134
130135
case "$ARCH" in
131136
amd64)
132-
if [[ "$COMPONENT" == "sandbox" ]]; then
137+
if [[ "$COMPONENT" == "sandbox" || "$COMPONENT" == "cli" ]]; then
133138
target=x86_64-unknown-linux-musl
134139
zig_target=x86_64-linux-musl
135140
else
@@ -138,7 +143,7 @@ jobs:
138143
fi
139144
;;
140145
arm64)
141-
if [[ "$COMPONENT" == "sandbox" ]]; then
146+
if [[ "$COMPONENT" == "sandbox" || "$COMPONENT" == "cli" ]]; then
142147
target=aarch64-unknown-linux-musl
143148
zig_target=aarch64-linux-musl
144149
else
@@ -214,6 +219,12 @@ jobs:
214219
OPENSHELL_IMAGE_TAG: ${{ inputs['image-tag'] }}
215220
run: |
216221
set -euo pipefail
222+
# z3 built with zig c++ uses libc++ symbols (std::__1::*).
223+
# Override z3-sys default (stdc++) so Rust links the matching runtime.
224+
if [[ "${{ inputs.component }}" == "cli" ]]; then
225+
echo "CXXSTDLIB=c++" >> "$GITHUB_ENV"
226+
fi
227+
217228
mise x -- rustup target add "${{ steps.target.outputs.target }}"
218229
cargo_cmd=(cargo build)
219230
build_target="${{ steps.target.outputs.target }}"

mise.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)