|
| 1 | +name: Build elizaOS Linux ISO |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + channel: |
| 7 | + type: string |
| 8 | + default: stable |
| 9 | + publish: |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + channel: |
| 15 | + description: Release channel |
| 16 | + type: choice |
| 17 | + options: [nightly, beta, stable] |
| 18 | + default: nightly |
| 19 | + publish: |
| 20 | + description: Upload to GitHub Release |
| 21 | + type: boolean |
| 22 | + default: false |
| 23 | + schedule: |
| 24 | + - cron: '0 3 * * *' |
| 25 | + release: |
| 26 | + types: [created] |
| 27 | + |
| 28 | +jobs: |
| 29 | + build-iso: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + timeout-minutes: 120 |
| 32 | + env: |
| 33 | + CHANNEL: ${{ inputs.channel || (github.event_name == 'release' && 'stable') || 'nightly' }} |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + - name: Install live-build and dependencies |
| 42 | + run: | |
| 43 | + sudo apt-get update -qq |
| 44 | + sudo apt-get install -y --no-install-recommends \ |
| 45 | + live-build \ |
| 46 | + just \ |
| 47 | + squashfs-tools \ |
| 48 | + xorriso \ |
| 49 | + isolinux \ |
| 50 | + syslinux-efi \ |
| 51 | + grub-efi-amd64-bin \ |
| 52 | + grub-pc-bin \ |
| 53 | + mtools \ |
| 54 | + dosfstools \ |
| 55 | + python3 \ |
| 56 | + curl \ |
| 57 | + rsync |
| 58 | +
|
| 59 | + - name: Set up Bun |
| 60 | + uses: oven-sh/setup-bun@v2 |
| 61 | + with: |
| 62 | + bun-version: "1.3.13" |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: bun install --frozen-lockfile |
| 66 | + |
| 67 | + - name: Restore model cache |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: ~/.cache/usbeliza-build/models |
| 71 | + key: elizaos-model-cache-${{ hashFiles('packages/os/linux/Justfile') }} |
| 72 | + restore-keys: elizaos-model-cache- |
| 73 | + |
| 74 | + - name: Restore CLI cache |
| 75 | + uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: ~/.cache/usbeliza-build/cli |
| 78 | + key: elizaos-cli-cache-${{ hashFiles('packages/os/linux/Justfile') }} |
| 79 | + restore-keys: elizaos-cli-cache- |
| 80 | + |
| 81 | + - name: Install Rust toolchain |
| 82 | + uses: dtolnay/rust-toolchain@stable |
| 83 | + with: |
| 84 | + targets: x86_64-unknown-linux-gnu |
| 85 | + |
| 86 | + - name: Cache Rust build |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: | |
| 90 | + ~/.cargo/registry |
| 91 | + ~/.cargo/git |
| 92 | + packages/os/linux/target |
| 93 | + key: elizaos-iso-rust-${{ runner.os }}-${{ hashFiles('packages/os/linux/**/Cargo.lock', 'packages/os/linux/**/Cargo.toml') }} |
| 94 | + restore-keys: elizaos-iso-rust-${{ runner.os }}- |
| 95 | + |
| 96 | + - name: Stage ISO build |
| 97 | + working-directory: packages/os/linux |
| 98 | + run: just iso-stage |
| 99 | + |
| 100 | + - name: Cache pre-downloaded models |
| 101 | + working-directory: packages/os/linux |
| 102 | + run: just iso-cache-model |
| 103 | + |
| 104 | + - name: Cache pre-downloaded CLIs |
| 105 | + working-directory: packages/os/linux |
| 106 | + run: just iso-cache-cli |
| 107 | + |
| 108 | + - name: Configure live-build |
| 109 | + working-directory: packages/os/linux |
| 110 | + run: just iso-config |
| 111 | + |
| 112 | + - name: Validate ISO config |
| 113 | + working-directory: packages/os/linux |
| 114 | + run: just iso-check |
| 115 | + |
| 116 | + - name: Build ISO |
| 117 | + working-directory: packages/os/linux |
| 118 | + run: sudo just iso-build |
| 119 | + timeout-minutes: 90 |
| 120 | + |
| 121 | + - name: Locate and rename ISO |
| 122 | + id: iso |
| 123 | + run: | |
| 124 | + ISO=$(find packages/os/linux -name "*.iso" | head -1) |
| 125 | + if [ -z "$ISO" ]; then |
| 126 | + echo "ERROR: ISO not found after build" |
| 127 | + exit 1 |
| 128 | + fi |
| 129 | + DATE=$(date +%Y.%m.%d) |
| 130 | + DEST="elizaos-linux-live-${CHANNEL}-${DATE}-amd64.iso" |
| 131 | + cp "$ISO" "$DEST" |
| 132 | + SHA256=$(sha256sum "$DEST" | cut -d' ' -f1) |
| 133 | + SIZE=$(stat --format="%s" "$DEST") |
| 134 | + echo "path=$DEST" >> "$GITHUB_OUTPUT" |
| 135 | + echo "sha256=$SHA256" >> "$GITHUB_OUTPUT" |
| 136 | + echo "size=$SIZE" >> "$GITHUB_OUTPUT" |
| 137 | + echo "filename=$DEST" >> "$GITHUB_OUTPUT" |
| 138 | +
|
| 139 | + - name: Generate SHA256SUMS |
| 140 | + run: | |
| 141 | + sha256sum "${{ steps.iso.outputs.path }}" > "${{ steps.iso.outputs.filename }}.sha256" |
| 142 | +
|
| 143 | + - name: Smoke test ISO (headless QEMU) |
| 144 | + if: runner.os == 'Linux' |
| 145 | + continue-on-error: true |
| 146 | + run: | |
| 147 | + sudo apt-get install -y --no-install-recommends qemu-system-x86 ovmf |
| 148 | + # Boot headless for 60 seconds and check for boot completion via serial |
| 149 | + QEMU_TIMEOUT=120 |
| 150 | + ISO_PATH="${{ steps.iso.outputs.path }}" |
| 151 | + SERIAL_LOG=$(mktemp) |
| 152 | + timeout "$QEMU_TIMEOUT" qemu-system-x86_64 \ |
| 153 | + -cdrom "$ISO_PATH" \ |
| 154 | + -boot d \ |
| 155 | + -m 2G \ |
| 156 | + -smp 2 \ |
| 157 | + -display none \ |
| 158 | + -vga none \ |
| 159 | + -serial "file:$SERIAL_LOG" \ |
| 160 | + -no-reboot \ |
| 161 | + -nographic 2>/dev/null || true |
| 162 | + if grep -qi "elizaOS\|eliza\|login:" "$SERIAL_LOG" 2>/dev/null; then |
| 163 | + echo "ISO smoke test: boot strings found in serial log" |
| 164 | + else |
| 165 | + echo "WARN: boot strings not detected in serial log (QEMU may not support KVM in CI)" |
| 166 | + fi |
| 167 | + rm -f "$SERIAL_LOG" |
| 168 | +
|
| 169 | + - name: Upload ISO artifact |
| 170 | + uses: actions/upload-artifact@v4 |
| 171 | + with: |
| 172 | + name: elizaos-linux-iso-${{ env.CHANNEL }} |
| 173 | + path: | |
| 174 | + ${{ steps.iso.outputs.path }} |
| 175 | + ${{ steps.iso.outputs.filename }}.sha256 |
| 176 | + retention-days: 7 |
| 177 | + |
| 178 | + - name: Upload to GitHub Release |
| 179 | + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish == 'true') || (github.event_name == 'workflow_call' && inputs.publish == true) |
| 180 | + uses: softprops/action-gh-release@v2 |
| 181 | + with: |
| 182 | + files: | |
| 183 | + ${{ steps.iso.outputs.path }} |
| 184 | + ${{ steps.iso.outputs.filename }}.sha256 |
| 185 | + tag_name: ${{ github.event.release.tag_name || github.ref_name }} |
| 186 | + env: |
| 187 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 188 | + |
| 189 | + - name: Write ISO metadata to summary |
| 190 | + run: | |
| 191 | + { |
| 192 | + echo "## elizaOS Linux ISO" |
| 193 | + echo "| Field | Value |" |
| 194 | + echo "| ----- | ----- |" |
| 195 | + echo "| File | \`${{ steps.iso.outputs.filename }}\` |" |
| 196 | + echo "| SHA-256 | \`${{ steps.iso.outputs.sha256 }}\` |" |
| 197 | + echo "| Size | ${{ steps.iso.outputs.size }} bytes |" |
| 198 | + echo "| Channel | ${CHANNEL} |" |
| 199 | + } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments