mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 15:10:28 +00:00
feat: CI build scripts #99 merge and updates
This commit is contained in:
parent
8c3c50983e
commit
cd019bb3ef
2 changed files with 32 additions and 34 deletions
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
|
@ -2,13 +2,15 @@ name: Build Application
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches:
|
||||||
- 'stable'
|
- 'master'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'screenshots/**'
|
- 'screenshots/**'
|
||||||
- '**/LICENSE'
|
- '**/LICENSE'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
- 'screenshots/**'
|
- 'screenshots/**'
|
||||||
|
@ -18,7 +20,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -37,11 +39,14 @@ jobs:
|
||||||
./build-iso.sh --headless
|
./build-iso.sh --headless
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Releasing latest
|
||||||
uses: actions/upload-artifact@v3
|
if: ${{ success() }}
|
||||||
|
uses: "GutPuncher/action-automatic-releases@latest"
|
||||||
with:
|
with:
|
||||||
name: ISOs
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
path: |
|
automatic_release_tag: "latest"
|
||||||
build/*.iso
|
prerelease: false
|
||||||
|
title: "Pre-Built ISOs [${{ github.sha }}]"
|
||||||
|
files: ./build/*.iso
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,9 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
|
[ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
|
||||||
SUDO='none'
|
|
||||||
command -v doas && SUDO=doas
|
|
||||||
command -v sudo && SUDO=sudo
|
|
||||||
if [ "$SUDO" = "none" ] ; then
|
|
||||||
echo 'No sudo or doas installed. Cannot proceed.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
KVM=''
|
KVM=''
|
||||||
(lsmod | grep -q kvm) && KVM=',accel=kvm'
|
(lsmod | grep -q kvm) && KVM=' -accel kvm'
|
||||||
|
|
||||||
# Set this true if you want to test ISOs in QEMU after building.
|
# Set this true if you want to test ISOs in QEMU after building.
|
||||||
TESTING=false
|
TESTING=false
|
||||||
|
@ -37,16 +30,16 @@ TMPMOUNT="$TMPDIR/mnt"
|
||||||
QEMU_BIN_PATH=$(dirname "$(which qemu-system-x86_64)")
|
QEMU_BIN_PATH=$(dirname "$(which qemu-system-x86_64)")
|
||||||
|
|
||||||
mount_tempdisk() {
|
mount_tempdisk() {
|
||||||
$SUDO modprobe nbd
|
sudo modprobe nbd
|
||||||
$SUDO $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
|
sudo $QEMU_BIN_PATH/qemu-nbd -c /dev/nbd0 -f raw $TMPDISK
|
||||||
$SUDO partprobe /dev/nbd0
|
sudo partprobe /dev/nbd0
|
||||||
$SUDO mount /dev/nbd0p1 $TMPMOUNT
|
sudo mount /dev/nbd0p1 $TMPMOUNT
|
||||||
}
|
}
|
||||||
|
|
||||||
umount_tempdisk() {
|
umount_tempdisk() {
|
||||||
sync
|
sync
|
||||||
$SUDO umount $TMPMOUNT
|
sudo umount $TMPMOUNT
|
||||||
$SUDO $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
sudo $QEMU_BIN_PATH/qemu-nbd -d /dev/nbd0
|
||||||
}
|
}
|
||||||
|
|
||||||
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
[ ! -d $TMPMOUNT ] && mkdir -p $TMPMOUNT
|
||||||
|
@ -59,19 +52,19 @@ set +e
|
||||||
|
|
||||||
echo "Making temp vdisk, running auto-install ..."
|
echo "Making temp vdisk, running auto-install ..."
|
||||||
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
|
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
|
||||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS
|
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS
|
||||||
|
|
||||||
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
|
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
|
||||||
rm ../src/Home/Registry.ZC 2> /dev/null
|
rm ../src/Home/Registry.ZC 2> /dev/null
|
||||||
rm ../src/Home/MakeHome.ZC 2> /dev/null
|
rm ../src/Home/MakeHome.ZC 2> /dev/null
|
||||||
rm ../src/Boot/Kernel.ZXE 2> /dev/null
|
rm ../src/Boot/Kernel.ZXE 2> /dev/null
|
||||||
mount_tempdisk
|
mount_tempdisk
|
||||||
$SUDO mkdir $TMPMOUNT/Tmp/OSBuild/
|
sudo mkdir $TMPMOUNT/Tmp/OSBuild/
|
||||||
$SUDO cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
|
sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
|
||||||
umount_tempdisk
|
umount_tempdisk
|
||||||
|
|
||||||
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
||||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
|
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
|
||||||
|
|
||||||
LIMINE_BINARY_BRANCH="v6.x-branch-binary"
|
LIMINE_BINARY_BRANCH="v6.x-branch-binary"
|
||||||
|
|
||||||
|
@ -105,7 +98,7 @@ sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-bios-hdd.h | wc -l)\]/g" limine/
|
||||||
mount_tempdisk
|
mount_tempdisk
|
||||||
echo "Extracting MyDistro ISO from vdisk ..."
|
echo "Extracting MyDistro ISO from vdisk ..."
|
||||||
cp $TMPMOUNT/Tmp/MyDistro.ISO.C ./ZealOS-MyDistro.iso
|
cp $TMPMOUNT/Tmp/MyDistro.ISO.C ./ZealOS-MyDistro.iso
|
||||||
$SUDO rm $TMPMOUNT/Tmp/MyDistro.ISO.C 2> /dev/null
|
sudo rm $TMPMOUNT/Tmp/MyDistro.ISO.C 2> /dev/null
|
||||||
echo "Setting up temp ISO directory contents for use with limine xorriso command ..."
|
echo "Setting up temp ISO directory contents for use with limine xorriso command ..."
|
||||||
sudo cp -rf $TMPMOUNT/* $TMPISODIR
|
sudo cp -rf $TMPMOUNT/* $TMPISODIR
|
||||||
sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null
|
sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null
|
||||||
|
@ -119,8 +112,8 @@ sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
||||||
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
||||||
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
||||||
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
||||||
$SUDO mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
||||||
$SUDO rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
||||||
umount_tempdisk
|
umount_tempdisk
|
||||||
|
|
||||||
xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \
|
xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \
|
||||||
|
@ -141,11 +134,11 @@ if [ "$TESTING" = true ]; then
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
|
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
|
||||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
|
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
|
||||||
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
|
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
|
||||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
|
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
|
||||||
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
|
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
|
||||||
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35$KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS
|
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# comment these 2 lines if you want lingering old Distro ISOs
|
# comment these 2 lines if you want lingering old Distro ISOs
|
||||||
|
@ -156,8 +149,8 @@ mv ./ZealOS-MyDistro.iso ./ZealOS-PublicDomain-BIOS-$(date +%Y-%m-%d-%H_%M_%S).i
|
||||||
mv ./ZealOS-limine.iso ./ZealOS-BSD2-UEFI-$(date +%Y-%m-%d-%H_%M_%S).iso
|
mv ./ZealOS-limine.iso ./ZealOS-BSD2-UEFI-$(date +%Y-%m-%d-%H_%M_%S).iso
|
||||||
|
|
||||||
echo "Deleting temp folder ..."
|
echo "Deleting temp folder ..."
|
||||||
$SUDO rm -rf $TMPDIR
|
sudo rm -rf $TMPDIR
|
||||||
$SUDO rm -rf $TMPISODIR
|
sudo rm -rf $TMPISODIR
|
||||||
echo "Finished."
|
echo "Finished."
|
||||||
echo
|
echo
|
||||||
echo "ISOs built:"
|
echo "ISOs built:"
|
||||||
|
|
Loading…
Reference in a new issue