archlinux-s390x/.github/workflows/release.yml
2025-06-05 20:48:16 +02:00

206 lines
8 KiB
YAML

name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
release_notes:
description: 'Release notes'
required: false
type: string
default: 'New release'
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write # Required for creating releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up build tools
run: |
sudo apt-get update
sudo apt-get install -y podman libarchive-tools wget
- name: Build container
run: make container
- name: Check for required busybox
run: |
if [ ! -f "boot/busybox-s390x-static" ]; then
echo "❌ ERROR: Static busybox not found!"
echo ""
echo "To build a release, you must first:"
echo "1. SSH into z/VM: ssh -i zvm.pem -o StrictHostKeyChecking=no \$ZVM_USER@\$ZVM_HOST"
echo "2. Run the build script: ./scripts/build-busybox-zvm.sh"
echo "3. Transfer the busybox binary: scp -i zvm.pem \$ZVM_USER@\$ZVM_HOST:~/busybox-s390x-static boot/"
echo "4. Commit the busybox binary to the repository"
echo ""
echo "The busybox MUST be built natively on s390x hardware for proper static linking."
exit 1
else
echo "✅ Static busybox found at boot/busybox-s390x-static"
ls -la boot/busybox-s390x-static
fi
- name: Setup z/VM environment
env:
ZVM_HOST: ${{ secrets.ZVM_HOST }}
ZVM_USER: ${{ secrets.ZVM_USER }}
ZVM_SSH_KEY: ${{ secrets.ZVM_SSH_KEY }}
run: |
# Validate required variables
if [ -z "$ZVM_HOST" ] || [ -z "$ZVM_USER" ] || [ -z "$ZVM_SSH_KEY" ]; then
echo "Error: Missing required z/VM configuration"
echo "Required secrets: ZVM_HOST, ZVM_USER, ZVM_SSH_KEY"
exit 1
fi
# Setup SSH
mkdir -p ~/.ssh
echo "$ZVM_SSH_KEY" > zvm.pem
chmod 600 zvm.pem
ssh-keyscan -H $ZVM_HOST >> ~/.ssh/known_hosts
# Export for later steps
echo "ZVM_HOST=$ZVM_HOST" >> $GITHUB_ENV
echo "ZVM_USER=$ZVM_USER" >> $GITHUB_ENV
echo "ZVM_PORT=${ZVM_PORT:-22}" >> $GITHUB_ENV
echo "SSH_CONNECT_TIMEOUT=${SSH_CONNECT_TIMEOUT:-10}" >> $GITHUB_ENV
- name: Test z/VM connectivity
run: |
ssh -i zvm.pem -o ConnectTimeout=$SSH_CONNECT_TIMEOUT $ZVM_USER@$ZVM_HOST "echo 'z/VM connection successful'"
- name: Build complete system
run: |
echo "Building s390x kernel and creating initramfs..."
make all
- name: Build systemd on z/VM
run: |
echo "Building systemd natively on z/VM..."
make systemd-zvm
timeout-minutes: 30
- name: Prepare release artifacts
run: |
mkdir -p release-artifacts
# Check if build succeeded
if [ ! -f "boot/vmlinuz-linux" ] || [ ! -f "boot/initramfs-linux.img" ]; then
echo "❌ ERROR: Build artifacts not found!"
echo "Expected files:"
echo " boot/vmlinuz-linux"
echo " boot/initramfs-linux.img"
echo ""
echo "Available files in boot/:"
ls -la boot/
echo ""
echo "Available files in output/:"
ls -la output/ || echo "output/ directory not found"
exit 1
fi
# Copy kernel (from boot directory after make all)
cp boot/vmlinuz-linux release-artifacts/vmlinuz-linux-s390x
# Copy initramfs (from boot directory after make all)
cp boot/initramfs-linux.img release-artifacts/initramfs-linux-s390x.img
# Copy boot configuration files (excluding large binaries)
cp boot/arch.prm release-artifacts/
cp boot/generic.ins release-artifacts/
cp boot/initrd.addrsize release-artifacts/
cp boot/boot-info.txt release-artifacts/
# Copy busybox binary
cp boot/busybox-s390x-static release-artifacts/
# Copy systemd artifacts if available
if [ -d "output/systemd-root" ]; then
echo "✅ Systemd found, including in release"
tar -czf release-artifacts/systemd-s390x.tar.gz -C output/systemd-root .
cp output/systemd-minimal-s390x.tar.gz release-artifacts/ 2>/dev/null || true
else
echo "⚠️ Systemd not found, release will be kernel + initramfs only"
fi
# Get actual sizes
KERNEL_SIZE=$(du -h boot/vmlinuz-linux | cut -f1)
INITRAMFS_SIZE=$(du -h boot/initramfs-linux.img | cut -f1)
BUSYBOX_SIZE=$(du -h boot/busybox-s390x-static | cut -f1)
SYSTEMD_SIZE=""
if [ -f "release-artifacts/systemd-s390x.tar.gz" ]; then
SYSTEMD_SIZE=$(du -h release-artifacts/systemd-s390x.tar.gz | cut -f1)
fi
# Create build info file
cat > release-artifacts/BUILD_INFO.txt << EOF
Arch Linux s390x Build Information
==================================
Build Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
Kernel Version: 6.6.10
Architecture: IBM s390x (big-endian)
Component Sizes:
- Kernel: $KERNEL_SIZE
- Initramfs: $INITRAMFS_SIZE
- Busybox: $BUSYBOX_SIZE$(if [ -n "$SYSTEMD_SIZE" ]; then echo "
- Systemd: $SYSTEMD_SIZE"; fi)
Build Method:
- Kernel: Cross-compiled in Fedora container with CONFIG_UNIX and CONFIG_KMOD
- Busybox: Statically compiled on z/VM RHEL 9.6
- Initramfs: Generated with modified mkinitcpio for s390x$(if [ -n "$SYSTEMD_SIZE" ]; then echo "
- Systemd: Natively compiled on IBM z/VM with mount/udevadm utilities"; fi)
Status: $(if [ -n "$SYSTEMD_SIZE" ]; then echo "Fully functional - boots with systemd to 'Welcome to Arch Linux!'"; else echo "Fully functional - boots to emergency shell"; fi)
Boot Targets Available:
- make test: Initramfs-only system
- make test-rootfs: Root filesystem with busybox init$(if [ -n "$SYSTEMD_SIZE" ]; then echo "
- make test-systemd: Full systemd boot with modern init system"; fi)
EOF
# Create checksums
cd release-artifacts
sha256sum * > SHA256SUMS
cd ..
# Create tarball of all artifacts
tar -czf archlinux-s390x-${{ github.event.inputs.version }}.tar.gz -C release-artifacts .
# Capture build information for GitHub release
echo "KERNEL_VERSION=6.6.10" >> $GITHUB_ENV
echo "BUSYBOX_VERSION=1.35.0" >> $GITHUB_ENV
echo "KERNEL_SIZE=$KERNEL_SIZE" >> $GITHUB_ENV
echo "INITRAMFS_SIZE=$INITRAMFS_SIZE" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.version }}
name: Arch Linux s390x ${{ github.event.inputs.version }}
body: |
${{ github.event.inputs.release_notes }}
draft: false
prerelease: false
files: |
archlinux-s390x-${{ github.event.inputs.version }}.tar.gz
release-artifacts/vmlinuz-linux-s390x
release-artifacts/initramfs-linux-s390x.img
release-artifacts/busybox-s390x-static
release-artifacts/systemd-s390x.tar.gz
release-artifacts/systemd-minimal-s390x.tar.gz
release-artifacts/BUILD_INFO.txt
release-artifacts/SHA256SUMS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}