1- # Keep this in sync with the copy in bootc-dev/bootc
21name : ' Bootc Ubuntu Setup'
32description : ' Default host setup'
3+ inputs :
4+ libvirt :
5+ description : ' Install libvirt and virtualization stack'
6+ required : false
7+ default : ' false'
48runs :
59 using : ' composite'
610 steps :
11+ # The default runners have TONS of crud on them...
12+ - name : Free up disk space on runner
13+ shell : bash
14+ run : |
15+ set -xeuo pipefail
16+ sudo df -h
17+ unwanted_pkgs=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
18+ azure-cli google-chrome-stable firefox mono-devel)
19+ unwanted_dirs=(/usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL)
20+ # Start background removal operations as systemd units; if this causes
21+ # races in the future around disk space we can look at waiting for cleanup
22+ # before starting further jobs, but right now we spent a lot of time waiting
23+ # on the network and scripts and such below, giving these plenty of time to run.
24+ n=0
25+ runcleanup() {
26+ sudo systemd-run -r -u action-cleanup-${n} -- "$@"
27+ n=$(($n + 1))
28+ }
29+ runcleanup docker image prune --all --force
30+ for x in ${unwanted_dirs[@]}; do
31+ runcleanup rm -rf "$x"
32+ done
33+ # Apt removals in foreground, as we can't parallelize these
34+ for x in ${unwanted_pkgs[@]}; do
35+ /bin/time -f '%E %C' sudo apt-get remove -y $x
36+ done
737 # We really want support for heredocs
838 - name : Update podman and install just
939 shell : bash
@@ -14,29 +44,14 @@ runs:
1444 test "${IDV}" = "ubuntu-24.04"
1545 # plucky is the next release
1646 echo 'deb http://azure.archive.ubuntu.com/ubuntu plucky universe main' | sudo tee /etc/apt/sources.list.d/plucky.list
17- sudo apt update
47+ /bin/time -f '%E %C' sudo apt update
1848 # skopeo is currently older in plucky for some reason hence --allow-downgrades
19- sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
20- # The default runners have TONS of crud on them...
21- - name : Free up disk space on runner
22- shell : bash
23- run : |
24- sudo df -h
25- unwanted=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
26- azure-cli google-chrome-stable firefox mono-devel)
27- for x in ${unwanted[@]}; do
28- sudo apt-get remove -y $x > /dev/null
29- done
30- # Start other removal operations in parallel
31- sudo docker image prune --all --force > /dev/null &
32- sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android &
33- # Wait for all background processes to complete
34- wait
35- sudo df -h
49+ /bin/time -f '%E %C' sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
3650 # This is the default on e.g. Fedora derivatives, but not Debian
3751 - name : Enable unprivileged /dev/kvm access
3852 shell : bash
3953 run : |
54+ set -xeuo pipefail
4055 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
4156 sudo udevadm control --reload-rules
4257 sudo udevadm trigger --name-match=kvm
4661 id : set_arch
4762 shell : bash
4863 run : echo "ARCH=$(arch)" >> $GITHUB_ENV
64+ # We often use Rust, so set up opinionated default caching
65+ - name : Setup Rust cache
66+ uses : Swatinem/rust-cache@v2
67+ with :
68+ cache-all-crates : true
69+ # Only generate caches on push to git main
70+ save-if : ${{ github.ref == 'refs/heads/main' }}
71+ # Suppress actually using the cache for builds running from
72+ # git main so that we avoid incremental compilation bugs
73+ lookup-only : ${{ github.ref == 'refs/heads/main' }}
74+ # Install libvirt stack if requested
75+ - name : Install libvirt and virtualization stack
76+ if : ${{ inputs.libvirt == 'true' }}
77+ shell : bash
78+ run : |
79+ set -xeuo pipefail
80+ export BCVK_VERSION=0.5.3
81+ /bin/time -f '%E %C' sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system
82+ # Something in the stack is overriding this, but we want session right now for bcvk
83+ echo LIBVIRT_DEFAULT_URI=qemu:///session >> $GITHUB_ENV
84+ td=$(mktemp -d)
85+ cd $td
86+ # Install bcvk
87+ target=bcvk-$(arch)-unknown-linux-gnu
88+ /bin/time -f '%E %C' curl -LO https://github.com/bootc-dev/bcvk/releases/download/v${BCVK_VERSION}/${target}.tar.gz
89+ tar xzf ${target}.tar.gz
90+ sudo install -T ${target} /usr/bin/bcvk
91+ cd -
92+ rm -rf "$td"
4993
94+ # Also bump the default fd limit as a workaround for https://github.com/bootc-dev/bcvk/issues/65
95+ sudo sed -i -e 's,^\* hard nofile 65536,* hard nofile 524288,' /etc/security/limits.conf
96+ - name : Cleanup status
97+ shell : bash
98+ run : |
99+ set -xeuo pipefail
100+ systemctl list-units 'action-cleanup*'
101+ df -h
0 commit comments