diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc3bc2e..5573aea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ jobs: package-box: name: Package Vagrant Boxes runs-on: ubuntu-22.04 + timeout-minutes: 60 strategy: fail-fast: false matrix: @@ -20,7 +21,7 @@ jobs: - name: Install Vagrant and QEMU run: | sudo apt-get install -qq -o=Dpkg::Use-Pty=0 moreutils - sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant qemu-system virtualbox + sudo chronic apt-get install -qq -o=Dpkg::Use-Pty=0 vagrant qemu-system virtualbox qemu libvirt-daemon-system libvirt-clients libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base # - name: Cache Vagrant boxes # uses: actions/cache@v3 # with: @@ -32,14 +33,15 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up VM + shell: sudo bash {0} run: | - rm -rf ~/.vagrant - rm -rf ~/.vagrant.d vagrant plugin install vagrant-disksize - vagrant plugin install vagrant-qemu + vagrant plugin install vagrant-libvirt + vagrant plugin install vagrant-mutate vagrant status vagrant up --provider libvirt ${{ matrix.box }} - name: Package box + shell: sudo bash {0} run: | vagrant package ${{ matrix.box }} --output ${{ matrix.box }}.box ls -ahl *.box diff --git a/Vagrantfile b/Vagrantfile index 05f3776..8112611 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,4 @@ Vagrant.configure("2") do |config| - config.disksize.size = "16GB" - config.vm.define "fbsd_12" do |c| c.vm.box = "roboxes/freebsd12" end @@ -13,7 +11,16 @@ Vagrant.configure("2") do |config| # c.vm.box = "roboxes/freebsd14" # end - config.vm.synced_folder ".", "/vagrant", disabled: true + config.vm.provider "libvirt" do |qe| + # https://vagrant-libvirt.github.io/vagrant-libvirt/configuration.html + qe.cpus = 2 + qe.memory = 8192 + end + + # config.disksize.size = "2GB" + config.vm.boot_timeout = 600 + + # config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.provision "shell", inline: <<~SHELL set -e @@ -53,41 +60,28 @@ Vagrant.configure("2") do |config| curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain 1.72.1 EOF + echo 'Cleaning up packages' pkg prime-list pkg clean + echo 'Cleaning up unneeded directories' rm -rf /usr/obj /usr/ports /usr/src /usr/tests /usr/lib/debug /var/db + echo 'Disk usage before cleanup:' + df -h + du -hs /home/vagrant + du -ah / | sort -r -h | head -25 + # Adapted from bento's minimize.sh. This writes zeroes to the disk so that the empty space is # easily compressed. - dd if=/dev/zero of=/EMPTY bs=1M || true + echo 'Zeroing out empty space' + dd if=/dev/zero of=/EMPTY bs=1G count=16 || true rm -f /EMPTY sync + echo 'Disk usage after cleanup:' df -h du -hs /home/vagrant du -ah / | sort -r -h | head -25 SHELL - - config.vm.provider "libvirt" do |qe| - # v.memory = 8192 - # v.smp = 3 - # v.qemu_dir = "/usr/share/qemu" - # v.arch = "x86_64" - # v.machine = "q35" - # v.cpu = "qemu64" - # v.net_device = "virtio-net-pci" - - # qe.arch = "x86_64" - # qe.machine = "q35" - # qe.cpu = "max" - # qe.smp = "cpus=2,sockets=1,cores=2,threads=1" - # qe.net_device = "virtio-net-pci" - # qe.extra_qemu_args = %w(-accel tcg,thread=multi,tb-size=512) - # #qe.qemu_dir = "/usr/share/qemu" - # qe.qemu_dir = "/opt/homebrew/opt/qemu/share/qemu" - # qe.no_daemonize = true - end - - config.vm.boot_timeout = 600 end