Skip to content

Commit

Permalink
build: Add CI/CD for OS builds and packaging (x86_64)
Browse files Browse the repository at this point in the history
  • Loading branch information
pojntfx committed Jun 19, 2024
1 parent 48b70f6 commit 7a361d0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/hydrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ jobs:
dst: out/*
runner: depot-ubuntu-22.04-32

# OS
- id: os
src: .
os: golang:bookworm
flags: -e '-v /tmp/ssh-key:/tmp/ssh-key'
cmd: ./Hydrunfile os drafteros-firecracker-x86_64_defconfig drafteros-x86_64.tar.zst
dst: out/drafteros-x86_64.tar.zst
runner: depot-ubuntu-22.04-32

steps:
- name: Maximize build space
Expand Down
45 changes: 45 additions & 0 deletions Hydrunfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,51 @@ if [ "$1" = "go" ]; then
# Build
CGO_ENABLED=0 bagop -j "$(nproc)" -b "$2" -x '(android/*|ios/*|plan9/*|aix/*|linux/loong64|freebsd/*|wasip1/*|js/*|openbsd/*|windows/*|darwin/*|solaris/*|dragonfly/*|netbsd/*|illumos/*)' -p "make build/$2 DST=\$DST" -d out

exit 0
fi

# OS
if [ "$1" = "os" ]; then
# Configure SSH access
eval "$(ssh-agent -s)"
ssh-add /tmp/ssh-key
mkdir -p ~/.ssh
ssh-keyscan github.com >>~/.ssh/known_hosts

# Install native dependencies
apt update
apt install -y curl make build-essential file cpio unzip rsync bc

# Configure Git
git config --global --add safe.directory '*'
git config --global url."ssh://git@github.com/".insteadOf "https://github.com/"

# Generate dependencies for packager
make depend

# Build packager
make build/drafter-packager

# Install packager
make install/drafter-packager

# Generate dependencies for OS
make depend/os OS_DEFCONFIG="$2"

# Build OS
FORCE_UNSAFE_CONFIGURE=1 make build/os

# Package OS
drafter-packager --package-path "out/$3" --devices '[
{
"name": "kernel",
"path": "out/package/vmlinux"
},
{
"name": "disk",
"path": "out/package/rootfs.ext4"
}
]'

exit 0
fi

0 comments on commit 7a361d0

Please sign in to comment.