Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Build Debian Package

on:
workflow_call:
inputs:
deb-version:
required: true
type: string
checkout-ref:
required: true
type: string
arch:
required: true
type: string
runner:
required: true
type: string
cli-target:
required: true
type: string
gnu-target:
required: true
type: string

permissions:
contents: read

defaults:
run:
shell: bash

jobs:
build:
name: Build Debian Package (Linux ${{ inputs.arch }})
runs-on: ${{ inputs.runner }}
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs['checkout-ref'] }}

- name: Download CLI artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-${{ inputs['cli-target'] }}
path: package-binaries/

- name: Download gateway artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-gateway-${{ inputs['gnu-target'] }}
path: package-binaries/

- name: Download VM driver artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-driver-vm-${{ inputs['gnu-target'] }}
path: package-binaries/

- name: Configure package inputs
run: |
set -euo pipefail
chmod +x package-binaries/openshell{,-gateway,-driver-vm}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also need to be addressed at the source?

ls -lah package-binaries

- name: Build Debian package
run: |
set -euo pipefail
OPENSHELL_CLI_BINARY="${PWD}/package-binaries/openshell" \
OPENSHELL_GATEWAY_BINARY="${PWD}/package-binaries/openshell-gateway" \
OPENSHELL_DRIVER_VM_BINARY="${PWD}/package-binaries/openshell-driver-vm" \
OPENSHELL_DEB_VERSION="${INPUTS_DEB_VERSION}" \
OPENSHELL_DEB_ARCH="${{ inputs.arch }}" \
OPENSHELL_OUTPUT_DIR=artifacts \
tasks/scripts/package-deb.sh
env:
INPUTS_DEB_VERSION: ${{ inputs['deb-version'] }}

- name: Upload Debian package artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: deb-linux-${{ inputs.arch }}
path: artifacts/*.deb
retention-days: 5
123 changes: 123 additions & 0 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Build RPM

on:
workflow_call:
inputs:
checkout-ref:
required: true
type: string
arch:
required: true
type: string
runner:
required: true
type: string
cli-target:
required: true
type: string
gateway-target:
required: true
type: string
rpm-version:
required: false
type: string
default: ""
rpm-release:
required: false
type: string
default: ""
cargo-version:
required: false
type: string
default: ""

permissions:
contents: read

defaults:
run:
shell: bash

jobs:
build:
name: Build RPM Package (Linux ${{ inputs.arch }})
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
container:
image: docker.io/library/fedora:44@sha256:be9d65e2344d805cc11114319c685ecaa96b6d9b4350a0a6460cdb931babbd19
steps:
- name: Install packaging dependencies
run: |
dnf install -y \
packit rpm-build \
cargo cargo-rpm-macros git-core \
pandoc python3-devel systemd-rpm-macros

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.checkout-ref }}
fetch-depth: 0

- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
shared-key: rpm-vendor-${{ inputs.arch }}
cache-targets: "false"
cache-bin: "false"
cache-on-failure: "true"

- name: Download CLI artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-${{ inputs.cli-target }}
path: package-binaries/

- name: Download gateway artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-gateway-${{ inputs.gateway-target }}
path: package-binaries/

- name: Configure package inputs
run: |
set -euo pipefail
chmod +x package-binaries/openshell{,-gateway}
ls -lah package-binaries

- name: Mark workspace safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Fetch tags
run: git fetch --tags --force

- name: Build RPMs via Packit
env:
OPENSHELL_RPM_VERSION: ${{ inputs.rpm-version }}
OPENSHELL_RPM_RELEASE: ${{ inputs.rpm-release }}
OPENSHELL_CARGO_VERSION: ${{ inputs.cargo-version }}
OPENSHELL_PREBUILT_BINARIES_DIR: ${{ github.workspace }}/package-binaries
run: packit build locally

- name: Collect RPM artifacts
run: |
set -euo pipefail
mkdir -p artifacts
mapfile -t rpms < <(find "$GITHUB_WORKSPACE" -maxdepth 3 -type f -name '*.rpm' ! -name '*.src.rpm' | sort)
if [ "${#rpms[@]}" -eq 0 ]; then
echo "::error::No RPM artifacts found under $GITHUB_WORKSPACE"
find "$GITHUB_WORKSPACE" -maxdepth 3 -type f | sort
exit 1
fi
cp "${rpms[@]}" artifacts/
echo "=== Built RPMs ==="
ls -lah artifacts/

- name: Upload RPM artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: rpm-linux-${{ inputs.arch }}
path: artifacts/*.rpm
retention-days: 5
87 changes: 87 additions & 0 deletions .github/workflows/build-vm-driver-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Build VM Driver Binary

on:
workflow_call:
inputs:
arch:
required: true
type: string
triple:
required: true
type: string
runner:
required: true
type: string
dev-shell:
required: true
type: string
interpreter:
required: false
type: string
default: ""
cargo-version:
required: true
type: string
image-tag:
required: false
type: string
default: ""
checkout-ref:
required: false
type: string
default: ""
secrets:
CACHIX_AUTH_TOKEN:
required: true

permissions:
contents: read

jobs:
build:
name: openshell-driver-vm (${{ inputs.triple }})
runs-on: ${{ inputs.runner }}
timeout-minutes: 60
defaults:
run:
shell: nix develop ${{ inputs['dev-shell'] }} -c bash -euo pipefail {0}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs['checkout-ref'] || github.sha }}

- uses: ./.github/actions/setup-nix
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Download openshell-sandbox
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-sandbox-${{ inputs.arch }}-unknown-linux-musl
path: sandbox

- name: Build VM runtime
run: nix build .#vm-runtime

- name: Assemble compressed VM runtime
run: |
compressed_dir="${RUNNER_TEMP}/vm-runtime-compressed"
install -d "$compressed_dir"
cp result/compressed/*.zst "$compressed_dir/"
zstd -19 -T1 sandbox/openshell-sandbox -o "$compressed_dir/openshell-sandbox.zst"

- name: Build openshell-driver-vm
uses: ./.github/actions/build-rust-binary
env:
OPENSHELL_VM_RUNTIME_COMPRESSED_DIR: ${{ runner.temp }}/vm-runtime-compressed
with:
package: openshell-driver-vm
binary: openshell-driver-vm
triple: ${{ inputs.triple }}
dev-shell: ${{ inputs['dev-shell'] }}
cargo-version: ${{ inputs['cargo-version'] }}
image-tag: ${{ inputs['image-tag'] }}
interpreter: ${{ inputs.interpreter }}
54 changes: 11 additions & 43 deletions .github/workflows/build-vm-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ permissions:

jobs:
build:
name: openshell-driver-vm (${{ matrix.triple }})
strategy:
matrix:
include:
Expand All @@ -44,45 +43,14 @@ jobs:
triple: aarch64-apple-darwin
runner: macos-15-xlarge
dev_shell: .#devShells.aarch64-darwin.default
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
defaults:
run:
shell: nix develop ${{ matrix.dev_shell }} -c bash -euo pipefail {0}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs['checkout-ref'] || github.sha }}

- uses: ./.github/actions/setup-nix
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Download openshell-sandbox
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-sandbox-${{ matrix.arch }}-unknown-linux-musl
path: sandbox

- name: Build VM runtime
run: nix build .#vm-runtime

- name: Assemble compressed VM runtime
run: |
compressed_dir="${RUNNER_TEMP}/vm-runtime-compressed"
install -d "$compressed_dir"
cp result/compressed/*.zst "$compressed_dir/"
zstd -19 -T1 sandbox/openshell-sandbox -o "$compressed_dir/openshell-sandbox.zst"

- name: Build openshell-driver-vm
uses: ./.github/actions/build-rust-binary
env:
OPENSHELL_VM_RUNTIME_COMPRESSED_DIR: ${{ runner.temp }}/vm-runtime-compressed
with:
package: openshell-driver-vm
binary: openshell-driver-vm
triple: ${{ matrix.triple }}
dev-shell: ${{ matrix.dev_shell }}
cargo-version: ${{ inputs['cargo-version'] }}
image-tag: ${{ inputs['image-tag'] }}
interpreter: ${{ matrix.interpreter }}
uses: ./.github/workflows/build-vm-driver-binary.yml
with:
arch: ${{ matrix.arch }}
triple: ${{ matrix.triple }}
runner: ${{ matrix.runner }}
dev-shell: ${{ matrix.dev_shell }}
interpreter: ${{ matrix.interpreter }}
cargo-version: ${{ inputs['cargo-version'] }}
image-tag: ${{ inputs['image-tag'] }}
checkout-ref: ${{ inputs['checkout-ref'] }}
secrets: inherit
Loading
Loading