mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-03 09:29:40 +08:00
ci(x64): add end-to-end build, verification, and release workflow
This commit is contained in:
145
.github/workflows/release-x64.yml
vendored
145
.github/workflows/release-x64.yml
vendored
@@ -105,15 +105,17 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
|
||||
with:
|
||||
node-version: 24
|
||||
node-version: 26
|
||||
package-manager-cache: false
|
||||
|
||||
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115
|
||||
with:
|
||||
cache: true
|
||||
|
||||
- name: Check prerequisites
|
||||
run: ./setup.sh --check
|
||||
- name: Check prerequisites and install JS deps
|
||||
run: |
|
||||
./setup.sh --check
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
- name: Cache keys
|
||||
id: keys
|
||||
@@ -151,13 +153,74 @@ jobs:
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
||||
with:
|
||||
path: vendor/downloads
|
||||
key: downloads-${{ hashFiles('kernel/tools/env.sh', 'kernel/build.sh', 'guest/**/pins.sh') }}
|
||||
restore-keys: downloads-
|
||||
key: x64-downloads-${{ hashFiles('kernel/tools/env.sh', 'kernel/build.sh', 'guest/**/pins.sh') }}
|
||||
restore-keys: x64-downloads-
|
||||
|
||||
- name: Run A64 baseline tests
|
||||
- name: Fetch Binaryen
|
||||
run: KW_ARCH=x64 kernel/build.sh binaryen
|
||||
|
||||
- name: Run kwemu x64 unit, JIT, and lockstep tests
|
||||
run: |
|
||||
zig build -Dkwemu-jit=true -Dcpu=baseline
|
||||
zig build test -Dcpu=baseline
|
||||
PATH="$PWD/vendor/toolchain/binaryen/bin:$PATH" zig build test -Dkwemu-arch=x64 -j"$(nproc)"
|
||||
|
||||
- name: Build kwemu-x64 UP and SMP libraries
|
||||
run: |
|
||||
zig build -Dkwemu-arch=x64 -Dkwemu-jit=true -Dcpu=baseline --prefix vendor/build/kwemu-x64
|
||||
zig build -Dkwemu-arch=x64 -Dkwemu-jit=true -Dkwemu-atomics=true -Dcpu=baseline --prefix vendor/build/kwemu-x64-smp
|
||||
|
||||
- name: Restore Linux x64 tree
|
||||
id: linux-src
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
||||
with:
|
||||
path: vendor/src/linux-wasm-kernel
|
||||
key: x64-linux-src-${{ steps.keys.outputs.linux }}-${{ hashFiles('kernel/patches/linux/**', 'kernel/patches/linux-x64/**') }}
|
||||
|
||||
- name: Restore Linux x64 build
|
||||
id: kernel-out
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
||||
with:
|
||||
path: |
|
||||
vendor/build/kernel-x64
|
||||
vendor/build/kernel-x64-smp
|
||||
key: x64-kernel-out-${{ steps.keys.outputs.clang }}-${{ hashFiles('kernel/patches/linux/**', 'kernel/patches/linux-x64/**', 'kernel/tools/fake-llvm/**') }}-${{ hashFiles('src/**', 'include/**', 'build.zig', 'build.zig.zon', 'kernel/build.sh') }}
|
||||
|
||||
- name: Clean mismatched kernel build
|
||||
if: steps.linux-src.outputs.cache-hit != 'true'
|
||||
run: rm -rf vendor/build/kernel-x64 vendor/build/kernel-x64-smp
|
||||
|
||||
- name: Build UP and SMP x64 kernels
|
||||
env:
|
||||
KW_ARCH: x64
|
||||
KWEMU: ${{ github.workspace }}/vendor/build/kwemu-x64/lib/libkwemu.a
|
||||
KWEMU_SMP: ${{ github.workspace }}/vendor/build/kwemu-x64-smp/lib/libkwemu.a
|
||||
run: |
|
||||
kernel/build.sh kernel
|
||||
kernel/build.sh smp
|
||||
|
||||
- name: Save Linux x64 tree
|
||||
if: steps.linux-src.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
||||
with:
|
||||
path: vendor/src/linux-wasm-kernel
|
||||
key: ${{ steps.linux-src.outputs.cache-primary-key }}
|
||||
|
||||
- name: Save Linux x64 build
|
||||
if: steps.kernel-out.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
|
||||
with:
|
||||
path: |
|
||||
vendor/build/kernel-x64
|
||||
vendor/build/kernel-x64-smp
|
||||
key: ${{ steps.kernel-out.outputs.cache-primary-key }}
|
||||
|
||||
- name: Build data disk template and base bundle
|
||||
env:
|
||||
KW_ARCH: x64
|
||||
KW_SMP: "1"
|
||||
run: |
|
||||
kernel/build.sh datadisk
|
||||
kernel/build.sh base
|
||||
ls -lh vendor/build/bundle-x64/unkernel.wasm vendor/build/initramfs-x64/base.cpio vendor/build/initramfs-x64/base-test.cpio
|
||||
|
||||
- name: Save downloads
|
||||
if: steps.downloads.outputs.cache-hit != 'true'
|
||||
@@ -166,6 +229,40 @@ jobs:
|
||||
path: vendor/downloads
|
||||
key: ${{ steps.downloads.outputs.cache-primary-key }}
|
||||
|
||||
- name: Run abitest, abitest32, and kwtest (UP and SMP)
|
||||
run: |
|
||||
for cpus in 1 4; do
|
||||
node js/cli.ts --timeout 300 --cpus "$cpus" --kernel vendor/build/bundle-x64/unkernel.wasm \
|
||||
--initrd vendor/build/initramfs-x64/base-test.cpio \
|
||||
--append "console=hvc0 rdinit=/usr/bin/abitest" --exit 1 </dev/null | tee abitest.log
|
||||
grep -q 'abitest x86_64: 0x00000000 failure(s)' abitest.log
|
||||
grep -q 'abitest32 i386: 0x00000000 failure(s)' abitest.log
|
||||
|
||||
node js/cli.ts --timeout 300 --cpus "$cpus" --kernel vendor/build/bundle-x64/unkernel.wasm \
|
||||
--initrd vendor/build/initramfs-x64/base-test.cpio \
|
||||
--append "console=hvc0 rdinit=/usr/bin/abitest32" --exit 1 </dev/null | tee abitest32.log
|
||||
grep -q 'abitest32 i386: 0x00000000 failure(s)' abitest32.log
|
||||
|
||||
node js/cli.ts --timeout 600 --cpus "$cpus" --kernel vendor/build/bundle-x64/unkernel.wasm \
|
||||
--initrd vendor/build/initramfs-x64/base-test.cpio \
|
||||
--append "console=hvc0 rdinit=/usr/bin/kwtest" --exit 1 </dev/null | tee kwtest.log
|
||||
grep -q 'kwtest: 0 failure(s)' kwtest.log
|
||||
done
|
||||
|
||||
- name: Pack release artifacts
|
||||
run: |
|
||||
mkdir -p out
|
||||
cp vendor/build/bundle-x64/unkernel.wasm out/unkernel.wasm
|
||||
(cd out && sha256sum unkernel.wasm > SHA256SUMS)
|
||||
cat out/SHA256SUMS
|
||||
ls -lh out/
|
||||
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
|
||||
with:
|
||||
name: release-x64
|
||||
path: out/
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: Tag and publish GitHub Release
|
||||
needs: [guard, build]
|
||||
@@ -175,7 +272,33 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Verify release gate
|
||||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
|
||||
with:
|
||||
name: release-x64
|
||||
path: out
|
||||
|
||||
- name: Create tag if needed
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ needs.guard.outputs.tag }}
|
||||
run: |
|
||||
echo "x64 release artifact pipeline will be finalized in Stage 5"
|
||||
exit 1
|
||||
if gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$TAG" --silent 2>/dev/null; then
|
||||
echo "$TAG exists"
|
||||
else
|
||||
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$GITHUB_SHA" --silent
|
||||
fi
|
||||
|
||||
- name: Publish GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ needs.guard.outputs.tag }}
|
||||
run: |
|
||||
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
||||
for f in out/*; do
|
||||
gh release upload "$TAG" "$f" --repo "$GITHUB_REPOSITORY" --clobber
|
||||
done
|
||||
else
|
||||
gh release create "$TAG" out/unkernel.wasm out/SHA256SUMS --repo "$GITHUB_REPOSITORY" \
|
||||
--latest --verify-tag --title "$TAG" \
|
||||
--notes "Native x86-64-v3 + i386 (IA32_EMULATION) UP+SMP unkernel.wasm bundle."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user