Skip to content

Commit b92e9bd

Browse files
authored
ci: add Fedora conformance workflow (#3086)
* ci: add Fedora conformance workflow Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: enable KVM for Fedora conformance Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: run Fedora conformance with KVM Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: copy Fedora conformance script into guest Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: limit conformance VM setup to KVM Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: streamline Fedora conformance builds Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: use dev supervisor for Fedora conformance Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: pin Fedora RPM build image Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: cache RPM vendoring dependencies Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: clarify Fedora conformance job name Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci: make conformance workflow manual only Signed-off-by: Simon Scatton <sscatton@nvidia.com> * ci(conformance): use new podman rootless install * fix(ci): build gateway from renamed package Signed-off-by: Simon Scatton <sscatton@nvidia.com> --------- Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent 06f0aa6 commit b92e9bd

6 files changed

Lines changed: 338 additions & 122 deletions

File tree

‎.github/workflows/build-rpm.yml‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Build RPM
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
checkout-ref:
10+
required: true
11+
type: string
12+
arch:
13+
required: true
14+
type: string
15+
runner:
16+
required: true
17+
type: string
18+
cli-target:
19+
required: true
20+
type: string
21+
gateway-target:
22+
required: true
23+
type: string
24+
rpm-version:
25+
required: false
26+
type: string
27+
default: ""
28+
rpm-release:
29+
required: false
30+
type: string
31+
default: ""
32+
cargo-version:
33+
required: false
34+
type: string
35+
default: ""
36+
37+
permissions:
38+
contents: read
39+
40+
defaults:
41+
run:
42+
shell: bash
43+
44+
jobs:
45+
build:
46+
name: Build RPM Package (Linux ${{ inputs.arch }})
47+
runs-on: ${{ inputs.runner }}
48+
timeout-minutes: 60
49+
container:
50+
image: docker.io/library/fedora:44@sha256:be9d65e2344d805cc11114319c685ecaa96b6d9b4350a0a6460cdb931babbd19
51+
steps:
52+
- name: Install packaging dependencies
53+
run: |
54+
dnf install -y \
55+
packit rpm-build \
56+
cargo cargo-rpm-macros git-core \
57+
pandoc python3-devel systemd-rpm-macros
58+
59+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
60+
with:
61+
ref: ${{ inputs.checkout-ref }}
62+
fetch-depth: 0
63+
64+
- name: Cache Cargo dependencies
65+
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
66+
with:
67+
shared-key: rpm-vendor-${{ inputs.arch }}
68+
cache-targets: "false"
69+
cache-bin: "false"
70+
cache-on-failure: "true"
71+
72+
- name: Download CLI artifact
73+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
74+
with:
75+
name: openshell-${{ inputs.cli-target }}
76+
path: package-binaries/
77+
78+
- name: Download gateway artifact
79+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
80+
with:
81+
name: openshell-gateway-${{ inputs.gateway-target }}
82+
path: package-binaries/
83+
84+
- name: Configure package inputs
85+
run: |
86+
set -euo pipefail
87+
chmod +x package-binaries/openshell{,-gateway}
88+
ls -lah package-binaries
89+
90+
- name: Mark workspace safe for git
91+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
92+
93+
- name: Fetch tags
94+
run: git fetch --tags --force
95+
96+
- name: Build RPMs via Packit
97+
env:
98+
OPENSHELL_RPM_VERSION: ${{ inputs.rpm-version }}
99+
OPENSHELL_RPM_RELEASE: ${{ inputs.rpm-release }}
100+
OPENSHELL_CARGO_VERSION: ${{ inputs.cargo-version }}
101+
OPENSHELL_PREBUILT_BINARIES_DIR: ${{ github.workspace }}/package-binaries
102+
run: packit build locally
103+
104+
- name: Collect RPM artifacts
105+
run: |
106+
set -euo pipefail
107+
mkdir -p artifacts
108+
mapfile -t rpms < <(find "$GITHUB_WORKSPACE" -maxdepth 3 -type f -name '*.rpm' ! -name '*.src.rpm' | sort)
109+
if [ "${#rpms[@]}" -eq 0 ]; then
110+
echo "::error::No RPM artifacts found under $GITHUB_WORKSPACE"
111+
find "$GITHUB_WORKSPACE" -maxdepth 3 -type f | sort
112+
exit 1
113+
fi
114+
cp "${rpms[@]}" artifacts/
115+
echo "=== Built RPMs ==="
116+
ls -lah artifacts/
117+
118+
- name: Upload RPM artifacts
119+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
120+
with:
121+
name: rpm-linux-${{ inputs.arch }}
122+
path: artifacts/*.rpm
123+
retention-days: 5

‎.github/workflows/conformance.yml‎

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Conformance
5+
6+
on:
7+
workflow_dispatch: {}
8+
9+
permissions: {}
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
pr_metadata:
17+
name: Resolve PR metadata
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
outputs:
23+
should_run: ${{ steps.gate.outputs.should_run }}
24+
steps:
25+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26+
- id: gate
27+
uses: ./.github/actions/pr-gate
28+
29+
version:
30+
needs: pr_metadata
31+
if: needs.pr_metadata.outputs.should_run == 'true'
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 5
34+
permissions:
35+
contents: read
36+
outputs:
37+
cargo: ${{ steps.version.outputs.cargo }}
38+
rpm_version: ${{ steps.version.outputs.rpm_version }}
39+
rpm_release: ${{ steps.version.outputs.rpm_release }}
40+
steps:
41+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Compute versions
46+
id: version
47+
run: |
48+
cargo="$(python3 tasks/scripts/release.py get-version --cargo)"
49+
rpm_version="$(python3 tasks/scripts/release.py get-version --rpm-version)"
50+
rpm_release="$(python3 tasks/scripts/release.py get-version --rpm-release)"
51+
{
52+
echo "cargo=$cargo"
53+
echo "rpm_version=$rpm_version"
54+
echo "rpm_release=$rpm_release"
55+
} >> "$GITHUB_OUTPUT"
56+
57+
build-cli:
58+
needs: version
59+
permissions:
60+
contents: read
61+
uses: ./.github/workflows/build-binaries.yml
62+
with:
63+
package: openshell-cli
64+
binary: openshell
65+
triple: x86_64-unknown-linux-musl
66+
runner: linux-amd64-cpu8
67+
dev-shell: .#devShells.x86_64-linux.musl
68+
cargo-version: ${{ needs.version.outputs.cargo }}
69+
checkout-ref: ${{ github.sha }}
70+
secrets: inherit
71+
72+
build-conformance:
73+
needs: version
74+
permissions:
75+
contents: read
76+
uses: ./.github/workflows/build-binaries.yml
77+
with:
78+
package: openshell-conformance-cli
79+
binary: openshell-conformance
80+
triple: x86_64-unknown-linux-musl
81+
runner: linux-amd64-cpu8
82+
dev-shell: .#devShells.x86_64-linux.musl
83+
cargo-version: ${{ needs.version.outputs.cargo }}
84+
checkout-ref: ${{ github.sha }}
85+
secrets: inherit
86+
87+
build-gateway:
88+
needs: version
89+
permissions:
90+
contents: read
91+
uses: ./.github/workflows/build-binaries.yml
92+
with:
93+
package: openshell-gateway
94+
binary: openshell-gateway
95+
triple: x86_64-unknown-linux-gnu
96+
runner: linux-amd64-cpu8
97+
dev-shell: .#devShells.x86_64-linux.glibc-2-28
98+
cargo-version: ${{ needs.version.outputs.cargo }}
99+
image-tag: dev
100+
interpreter: /lib64/ld-linux-x86-64.so.2
101+
checkout-ref: ${{ github.sha }}
102+
secrets: inherit
103+
104+
build-rpm:
105+
needs: [version, build-cli, build-gateway]
106+
permissions:
107+
contents: read
108+
uses: ./.github/workflows/build-rpm.yml
109+
with:
110+
checkout-ref: ${{ github.sha }}
111+
arch: x86_64
112+
runner: linux-amd64-cpu8
113+
cli-target: x86_64-unknown-linux-musl
114+
gateway-target: x86_64-unknown-linux-gnu
115+
cargo-version: ${{ needs.version.outputs.cargo }}
116+
rpm-version: ${{ needs.version.outputs.rpm_version }}
117+
rpm-release: ${{ needs.version.outputs.rpm_release }}
118+
119+
fedora:
120+
name: Fedora with Rootless Podman
121+
needs: [build-conformance, build-rpm]
122+
runs-on: ubuntu-24.04
123+
timeout-minutes: 45
124+
permissions:
125+
actions: read
126+
contents: read
127+
steps:
128+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
129+
with:
130+
persist-credentials: false
131+
132+
- name: Enable KVM access
133+
run: |
134+
set -euo pipefail
135+
if [[ ! -c /dev/kvm ]]; then
136+
echo "::error::The runner did not expose /dev/kvm"
137+
exit 1
138+
fi
139+
sudo chmod 0666 /dev/kvm
140+
exec 3<>/dev/kvm
141+
exec 3>&-
142+
143+
- uses: ./.github/actions/setup-nix
144+
145+
- name: Download RPM artifacts
146+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
147+
with:
148+
name: rpm-linux-x86_64
149+
path: rpm-input
150+
151+
- name: Download conformance CLI
152+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
153+
with:
154+
name: openshell-conformance-x86_64-unknown-linux-musl
155+
path: conformance-input
156+
157+
- name: Install RPMs and check status
158+
shell: bash
159+
run: |
160+
set -euo pipefail
161+
chmod +x conformance-input/openshell-conformance
162+
guest_script="$RUNNER_TEMP/conformance.sh"
163+
cat > "$guest_script" <<'EOF'
164+
set -euo pipefail
165+
166+
on_exit() {
167+
rc=$?
168+
trap - EXIT
169+
if [ "$rc" -ne 0 ]; then
170+
systemctl --user status openshell-gateway --no-pager || true
171+
journalctl --user -u openshell-gateway --no-pager -n 200 || true
172+
podman info || true
173+
podman ps --all || true
174+
getenforce || true
175+
fi
176+
exit "$rc"
177+
}
178+
trap on_exit EXIT
179+
180+
mkdir -p "$HOME/.config/openshell"
181+
echo 'OPENSHELL_TELEMETRY_ENABLED=false' > "$HOME/.config/openshell/gateway.env"
182+
systemctl --user enable --now openshell-gateway
183+
openshell gateway add --local https://127.0.0.1:17670 --name openshell
184+
/tmp/openshell-conformance run smoke
185+
EOF
186+
187+
OPENSHELL_TEST_GUEST_CACHE_DISABLE=1 nix run .#test-guest -- \
188+
--distro fedora \
189+
--with podman-rootless \
190+
--with selinux \
191+
--install rpm-input/openshell-[0-9]*.rpm \
192+
--install rpm-input/openshell-gateway-[0-9]*.rpm \
193+
--copy "$guest_script:/tmp/conformance.sh" \
194+
--copy conformance-input/openshell-conformance:/tmp/openshell-conformance \
195+
-- bash /tmp/conformance.sh

0 commit comments

Comments
 (0)