3838 cargo="$(python3 tasks/scripts/release.py get-version --cargo)"
3939 echo "cargo=$cargo" >> "$GITHUB_OUTPUT"
4040
41- binary :
41+ rust- binary :
4242 name : ${{ matrix.binary }} (${{ matrix.triple }})
4343 needs : version
4444 strategy :
5656 triple : aarch64-apple-darwin
5757 runner : macos-15-xlarge
5858 dev_shell : .#devShells.aarch64-darwin.default
59+ - binary : openshell-sandbox
60+ triple : x86_64-unknown-linux-musl
61+ runner : linux-amd64-cpu8
62+ dev_shell : .#devShells.x86_64-linux.musl
63+ - binary : openshell-sandbox
64+ triple : aarch64-unknown-linux-musl
65+ runner : linux-arm64-cpu8
66+ dev_shell : .#devShells.aarch64-linux.musl
5967 - binary : openshell-gateway
6068 triple : x86_64-unknown-linux-gnu
6169 runner : linux-amd64-cpu8
@@ -72,70 +80,97 @@ jobs:
7280 dev_shell : .#devShells.aarch64-darwin.default
7381 runs-on : ${{ matrix.runner }}
7482 timeout-minutes : 60
75- defaults :
76- run :
77- shell : nix develop ${{ matrix.dev_shell }} -c bash -euo pipefail {0}
7883 steps :
7984 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8085 with :
8186 ref : ${{ inputs['checkout-ref'] || github.sha }}
8287
83- - uses : cachix/install -nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
88+ - uses : ./.github/actions/setup -nix
8489 with :
85- github_access_token : ${{ secrets.GITHUB_TOKEN }}
90+ cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
8691
87- - uses : cachix/cachix-action@5f2d7c5294214f71b873db4b969586b980625e71 # v17
92+ - name : Build ${{ matrix.binary }}
93+ uses : ./.github/actions/build-rust-binary
94+ with :
95+ binary : ${{ matrix.binary }}
96+ triple : ${{ matrix.triple }}
97+ dev-shell : ${{ matrix.dev_shell }}
98+ cargo-version : ${{ needs.version.outputs.cargo }}
99+ interpreter : ${{ matrix.interpreter }}
100+
101+ vm-driver :
102+ name : openshell-driver-vm (${{ matrix.triple }})
103+ needs : [version, rust-binary]
104+ strategy :
105+ matrix :
106+ include :
107+ - arch : x86_64
108+ triple : x86_64-unknown-linux-gnu
109+ runner : linux-amd64-cpu8
110+ dev_shell : .#devShells.x86_64-linux.glibc-2-28
111+ interpreter : /lib64/ld-linux-x86-64.so.2
112+ - arch : aarch64
113+ triple : aarch64-unknown-linux-gnu
114+ runner : linux-arm64-cpu8
115+ dev_shell : .#devShells.aarch64-linux.glibc-2-28
116+ interpreter : /lib/ld-linux-aarch64.so.1
117+ - arch : aarch64
118+ triple : aarch64-apple-darwin
119+ runner : macos-15-xlarge
120+ dev_shell : .#devShells.aarch64-darwin.default
121+ runs-on : ${{ matrix.runner }}
122+ timeout-minutes : 60
123+ defaults :
124+ run :
125+ shell : nix develop ${{ matrix.dev_shell }} -c bash -euo pipefail {0}
126+ steps :
127+ - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
88128 with :
89- name : openshell
90- authToken : ${{ secrets.CACHIX_AUTH_TOKEN }}
129+ ref : ${{ inputs['checkout-ref'] || github.sha }}
91130
92- - name : Cache Rust artifacts
93- uses : Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
131+ - uses : ./.github/actions/setup-nix
94132 with :
95- shared-key : binaries-${{ matrix.binary }}-${{ matrix.triple }}
96- cache-on-failure : " true"
97- cache-workspace-crates : " true"
98- cache-bin : " false"
99- cmd-format : nix develop ${{ matrix.dev_shell }} -c {0}
133+ cachix-auth-token : ${{ secrets.CACHIX_AUTH_TOKEN }}
100134
101- - name : Set version
102- run : sed -i 's/^version = "0\.0\.0"$/version = "${{ needs.version.outputs.cargo }}"/' Cargo.toml
135+ - name : Download openshell-sandbox
136+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
137+ with :
138+ name : openshell-sandbox-${{ matrix.arch }}-unknown-linux-musl
139+ path : sandbox
103140
104- - name : Build ${{ matrix.binary }}
105- run : GIT_DIR=/nonexistent cargo auditable build --release --bin "${{ matrix.binary }}"
141+ - name : Build VM runtime
142+ run : nix build .#vm-runtime
106143
107- - name : Verify ${{ matrix.binary }}
144+ - name : Compress Linux VM runtime
145+ if : runner.os == 'Linux'
108146 run : |
109- # Confirm the binary runs and reports the expected name.
110- target/release/${{ matrix.binary }} --version | grep -q '^${{ matrix.binary }} '
111- # Confirm Syft can decode the embedded cargo-auditable metadata.
112- SYFT_CHECK_FOR_APP_UPDATE=false syft "file:target/release/${{ matrix.binary }}" -o cyclonedx-json | grep 'pkg:cargo/' > /dev/null
113-
114- - name : Verify static linkage
115- if : endsWith(matrix.triple, '-linux-musl')
116- run : tasks/scripts/verify-static-binary.sh target/release/${{ matrix.binary }}
117-
118- - name : Normalize Linux dynamic binary
119- if : endsWith(matrix.triple, '-linux-gnu')
147+ install -d target/vm-runtime-compressed
148+ zstd -19 -T0 result/libkrun.so -o target/vm-runtime-compressed/libkrun.so.zst
149+ zstd -19 -T0 result/libkrunfw.so.5 -o target/vm-runtime-compressed/libkrunfw.so.5.zst
150+ zstd -19 -T0 result/gvproxy -o target/vm-runtime-compressed/gvproxy.zst
151+ zstd -19 -T0 result/umoci -o target/vm-runtime-compressed/umoci.zst
152+
153+ - name : Compress macOS VM runtime
154+ if : runner.os == 'macOS'
120155 run : |
121- binary=target/release/${{ matrix.binary }}
122- # Remove Nix store paths so the binary can run on other distributions.
123- patchelf --set-interpreter "${{ matrix.interpreter }}" --remove-rpath "$binary"
124- # Z3 must be embedded instead of loaded from the target system.
125- test -z "$(patchelf --print-needed "$binary" | grep '^libz3')"
126- # Reject symbols introduced after glibc 2.28.
127- tasks/scripts/verify-glibc-symbols.sh 2.28 "$binary"
128-
129- - name : Package ${{ matrix.binary }}
156+ install -d target/vm-runtime-compressed
157+ zstd -19 -T0 result/libkrun.dylib -o target/vm-runtime-compressed/libkrun.dylib.zst
158+ zstd -19 -T0 result/libkrunfw.5.dylib -o target/vm-runtime-compressed/libkrunfw.5.dylib.zst
159+ zstd -19 -T0 result/gvproxy -o target/vm-runtime-compressed/gvproxy.zst
160+ zstd -19 -T0 result/umoci -o target/vm-runtime-compressed/umoci.zst
161+
162+ - name : Add openshell-sandbox to VM runtime
130163 run : |
131- mkdir -p artifacts
132- install -m0755 target/release/${{ matrix.binary }} artifacts/${{ matrix.binary }}
133- tar -czf artifacts/${{ matrix.binary }}-${{ matrix.triple }}.tar.gz -C artifacts ${{ matrix.binary }}
164+ tar -xzf sandbox/openshell-sandbox-${{ matrix.arch }}-unknown-linux-musl.tar.gz -C sandbox
165+ zstd -19 -T0 sandbox/openshell-sandbox -o target/vm-runtime-compressed/openshell-sandbox.zst
134166
135- - name : Upload ${{ matrix.binary }}
136- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
167+ - name : Build openshell-driver-vm
168+ uses : ./.github/actions/build-rust-binary
169+ env :
170+ OPENSHELL_VM_RUNTIME_COMPRESSED_DIR : ${{ github.workspace }}/target/vm-runtime-compressed
137171 with :
138- name : ${{ matrix.binary }}-${{ matrix.triple }}
139- path : artifacts/*.tar.gz
140- retention-days : 5
141- if-no-files-found : error
172+ binary : openshell-driver-vm
173+ triple : ${{ matrix.triple }}
174+ dev-shell : ${{ matrix.dev_shell }}
175+ cargo-version : ${{ needs.version.outputs.cargo }}
176+ interpreter : ${{ matrix.interpreter }}
0 commit comments