From bb0693c32699378a093b92e5fee88718a93713bd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 8 Oct 2025 17:39:10 -0400 Subject: [PATCH 1/2] ci: move Rust caching into our setup action To avoid duplicative content. And add comments for why we're changing some of the options. Signed-off-by: Colin Walters --- .github/actions/bootc-ubuntu-setup/action.yml | 10 +++++++ .github/workflows/ci.yml | 30 ------------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/actions/bootc-ubuntu-setup/action.yml b/.github/actions/bootc-ubuntu-setup/action.yml index b9bdf9174..1530ae8eb 100644 --- a/.github/actions/bootc-ubuntu-setup/action.yml +++ b/.github/actions/bootc-ubuntu-setup/action.yml @@ -45,3 +45,13 @@ runs: id: set_arch shell: bash run: echo "ARCH=$(arch)" >> $GITHUB_ENV + # We often use Rust, so set up opinionated default caching + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: true + # Only generate caches on push to git main + save-if: ${{ github.ref == 'refs/heads/main' }} + # Suppress actually using the cache for builds running from + # git main so that we avoid incremental compilation bugs + lookup-only: ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31f2df466..00dd7ede6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,12 +32,6 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: true - save-if: ${{ github.ref == 'refs/heads/main' }} - lookup-only: ${{ github.ref == 'refs/heads/main' }} - name: Validate (default) run: just validate # Build container with continuous repository enabled @@ -47,12 +41,6 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: true - save-if: ${{ github.ref == 'refs/heads/main' }} - lookup-only: ${{ github.ref == 'refs/heads/main' }} - name: Build with continuous repo enabled run: sudo just build --build-arg=continuous_repo=1 # Check for security vulnerabilities and license compliance @@ -74,12 +62,6 @@ jobs: uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: true - save-if: ${{ github.ref == 'refs/heads/main' }} - lookup-only: ${{ github.ref == 'refs/heads/main' }} - name: Enable fsverity for / run: sudo tune2fs -O verity $(findmnt -vno SOURCE /) - name: Install utils @@ -133,12 +115,6 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: true - save-if: ${{ github.ref == 'refs/heads/main' }} - lookup-only: ${{ github.ref == 'refs/heads/main' }} - name: Build mdbook run: just build-mdbook # Build containers and disk images for integration testing across OS matrix @@ -154,12 +130,6 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-all-crates: true - save-if: ${{ github.ref == 'refs/heads/main' }} - lookup-only: ${{ github.ref == 'refs/heads/main' }} - name: Install qemu-utils run: sudo apt install -y qemu-utils From d5efb5ac9119b4f117559c8d58c3f03c597751a4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 8 Oct 2025 17:43:37 -0400 Subject: [PATCH 2/2] ci: Refactor libvirt setup Move libvirt installation into a parameterized input in the bootc-ubuntu-setup action, allowing workflows to opt-in via `libvirt: true`. This consolidates installation logic and makes workflows cleaner by removing duplicate package installation steps. Assisted-by: Claude Code Signed-off-by: Colin Walters --- .github/actions/bootc-ubuntu-setup/action.yml | 12 ++++++++++++ .github/workflows/ci.yml | 14 ++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/actions/bootc-ubuntu-setup/action.yml b/.github/actions/bootc-ubuntu-setup/action.yml index 1530ae8eb..98b8e32d7 100644 --- a/.github/actions/bootc-ubuntu-setup/action.yml +++ b/.github/actions/bootc-ubuntu-setup/action.yml @@ -1,5 +1,10 @@ name: 'Bootc Ubuntu Setup' description: 'Default host setup' +inputs: + libvirt: + description: 'Install libvirt and virtualization stack' + required: false + default: 'false' runs: using: 'composite' steps: @@ -55,3 +60,10 @@ runs: # Suppress actually using the cache for builds running from # git main so that we avoid incremental compilation bugs lookup-only: ${{ github.ref == 'refs/heads/main' }} + # Install libvirt stack if requested + - name: Install libvirt and virtualization stack + if: ${{ inputs.libvirt == 'true' }} + shell: bash + run: | + set -eux + sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm qemu-utils libvirt-daemon-system diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00dd7ede6..ec673185c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,8 +130,8 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Install qemu-utils - run: sudo apt install -y qemu-utils + with: + libvirt: true - name: Build container and disk image run: | @@ -162,12 +162,10 @@ jobs: - uses: actions/checkout@v4 - name: Bootc Ubuntu Setup uses: ./.github/actions/bootc-ubuntu-setup - - name: Install deps - run: | - sudo apt-get update - # see https://tmt.readthedocs.io/en/stable/overview.html#install - sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-kvm qemu-utils libvirt-daemon-system just - pip install --user "tmt[provision-virtual]" + with: + libvirt: true + - name: Install tmt + run: pip install --user "tmt[provision-virtual]" - name: Create folder to save disk image run: mkdir -p target