Skip to content

Commit 9a6df09

Browse files
committed
ci: Consolidate and cleanup workflows
- Having separate workflows made sharing build artifacts not really possible, and it just makes sense to consolidate - Refactor shared parts into a little internal action Signed-off-by: Colin Walters <[email protected]>
1 parent cd8fa59 commit 9a6df09

File tree

4 files changed

+143
-152
lines changed

4 files changed

+143
-152
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 'Bootc Ubuntu Setup'
2+
description: 'Default host setup'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
# We really want support for heredocs
7+
- name: Update podman and install just
8+
shell: bash
9+
run: |
10+
set -eux
11+
# Require the runner is ubuntu-24.04
12+
IDV=$(. /usr/lib/os-release && echo ${ID}-${VERSION_ID})
13+
test "${IDV}" = "ubuntu-24.04"
14+
# plucky is the next release
15+
echo 'deb http://azure.archive.ubuntu.com/ubuntu plucky universe main' | sudo tee /etc/apt/sources.list.d/plucky.list
16+
sudo apt update
17+
# skopeo is currently older in plucky for some reason hence --allow-downgrades
18+
sudo apt install -y --allow-downgrades crun/plucky podman/plucky skopeo/plucky just
19+
# The default runners have TONS of crud on them...
20+
- name: Free up disk space on runner
21+
shell: bash
22+
run: |
23+
sudo df -h
24+
unwanted=('^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*'
25+
azure-cli google-chrome-stable firefox mono-devel)
26+
for x in ${unwanted[@]}; do
27+
sudo apt-get remove -y $x > /dev/null
28+
done
29+
# Start other removal operations in parallel
30+
sudo docker image prune --all --force > /dev/null &
31+
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android &
32+
# Wait for all background processes to complete
33+
wait
34+
sudo df -h
35+
# This is the default on e.g. Fedora derivatives, but not Debian
36+
- name: Enable unprivileged /dev/kvm access
37+
shell: bash
38+
run: |
39+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
40+
sudo udevadm control --reload-rules
41+
sudo udevadm trigger --name-match=kvm
42+
ls -l /dev/kvm
43+
# Used by a few workflows, but generally useful
44+
- name: Set architecture variable
45+
id: set_arch
46+
shell: bash
47+
run: echo "ARCH=$(arch)" >> $GITHUB_ENV

.github/workflows/ci.yml

Lines changed: 96 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# CI Workflow for bootc
2+
#
3+
# Core principles:
4+
# - Everything done here should be easy to replicate locally. Most tasks
5+
# should invoke `just <something>`.
6+
# - Most additions to this should be extending existing tasks; e.g.
7+
# there's places for unit and integration tests already.
18
name: CI
29

310
permissions:
@@ -18,60 +25,43 @@ concurrency:
1825
cancel-in-progress: true
1926

2027
jobs:
21-
# Wrapper for validation
28+
# Run basic validation checks (linting, formatting, etc)
2229
validate:
2330
runs-on: ubuntu-24.04
2431
steps:
25-
- name: Get a newer podman for heredoc support (from debian testing)
26-
run: |
27-
set -eux
28-
echo 'deb [trusted=yes] https://ftp.debian.org/debian/ testing main' | sudo tee /etc/apt/sources.list.d/testing.list
29-
sudo apt update
30-
sudo apt install -y crun/testing podman/testing skopeo/testing just
3132
- uses: actions/checkout@v4
32-
- name: Free up disk space on runner
33-
run: sudo ./ci/clean-gha-runner.sh
33+
- name: Bootc Ubuntu Setup
34+
uses: ./.github/actions/bootc-ubuntu-setup
3435
- name: Validate (default)
3536
run: just validate
37+
# Build container with continuous repository enabled
3638
container-continuous:
3739
runs-on: ubuntu-24.04
3840
steps:
39-
- name: Get a newer podman for heredoc support (from debian testing)
40-
run: |
41-
set -eux
42-
echo 'deb [trusted=yes] https://ftp.debian.org/debian/ testing main' | sudo tee /etc/apt/sources.list.d/testing.list
43-
sudo apt update
44-
sudo apt install -y crun/testing podman/testing skopeo/testing just
45-
- name: Installdeps
46-
run: sudo apt update && sudo apt install just
4741
- uses: actions/checkout@v4
48-
- name: Free up disk space on runner
49-
run: sudo ./ci/clean-gha-runner.sh
42+
- name: Bootc Ubuntu Setup
43+
uses: ./.github/actions/bootc-ubuntu-setup
5044
- name: Build with continuous repo enabled
5145
run: sudo just build --build-arg=continuous_repo=1
46+
# Check for security vulnerabilities and license compliance
5247
cargo-deny:
53-
runs-on: ubuntu-latest
48+
runs-on: ubuntu-24.04
5449
steps:
5550
- uses: actions/checkout@v4
5651
- uses: EmbarkStudios/cargo-deny-action@v2
5752
with:
5853
log-level: warn
5954
command: check -A duplicate bans sources licenses
55+
# Test bootc installation scenarios and fsverity support
56+
# TODO convert to be an integration test
6057
install-tests:
6158
name: "Test install"
62-
# For a not-ancient podman
6359
runs-on: ubuntu-24.04
6460
steps:
65-
- name: Get a newer podman for heredoc support (from debian testing)
66-
run: |
67-
set -eux
68-
echo 'deb [trusted=yes] https://ftp.debian.org/debian/ testing main' | sudo tee /etc/apt/sources.list.d/testing.list
69-
sudo apt update
70-
sudo apt install -y crun/testing podman/testing skopeo/testing just
7161
- name: Checkout repository
7262
uses: actions/checkout@v4
73-
- name: Free up disk space on runner
74-
run: sudo ./ci/clean-gha-runner.sh
63+
- name: Bootc Ubuntu Setup
64+
uses: ./.github/actions/bootc-ubuntu-setup
7565
- name: Enable fsverity for /
7666
run: sudo tune2fs -O verity $(findmnt -vno SOURCE /)
7767
- name: Install utils
@@ -118,9 +108,11 @@ jobs:
118108
sudo find /ostree/repo/objects -name '*.file' -type f | while read f; do
119109
sudo fsverity measure $f >/dev/null
120110
done
111+
# Build documentation using mdBook (only for PRs with 'documentation' label)
112+
# TODO move into Justfile
121113
docs:
122114
if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
123-
runs-on: ubuntu-latest
115+
runs-on: ubuntu-24.04
124116
env:
125117
MDBOOK_VERSION: 0.4.37
126118
steps:
@@ -149,3 +141,77 @@ jobs:
149141
echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
150142
- name: Build with mdBook
151143
run: cd docs && mdbook-mermaid install && mdbook build
144+
# Build containers and disk images for integration testing across OS matrix
145+
build-integration:
146+
strategy:
147+
fail-fast: false
148+
matrix:
149+
test_os: [fedora-42, fedora-43, centos-9, centos-10]
150+
151+
runs-on: ubuntu-24.04
152+
153+
steps:
154+
- uses: actions/checkout@v4
155+
- name: Bootc Ubuntu Setup
156+
uses: ./.github/actions/bootc-ubuntu-setup
157+
- name: Install qemu-utils
158+
run: sudo apt install -y qemu-utils
159+
160+
- name: Build container and disk image
161+
run: |
162+
sudo tests/build.sh ${{ matrix.test_os }}
163+
164+
- name: Run container tests
165+
run:
166+
sudo just test-container
167+
168+
- name: Archive disk image
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
172+
path: target/bootc-integration-test.qcow2
173+
retention-days: 1
174+
175+
# Run TMT-based integration tests on disk images from build-integration
176+
test-integration:
177+
needs: build-integration
178+
strategy:
179+
fail-fast: false
180+
matrix:
181+
test_os: [fedora-42, fedora-43, centos-9, centos-10]
182+
183+
runs-on: ubuntu-24.04
184+
185+
steps:
186+
- uses: actions/checkout@v4
187+
- name: Bootc Ubuntu Setup
188+
uses: ./.github/actions/bootc-ubuntu-setup
189+
- name: Install deps
190+
run: |
191+
sudo apt-get update
192+
# see https://tmt.readthedocs.io/en/stable/overview.html#install
193+
sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-kvm qemu-utils libvirt-daemon-system just
194+
pip install --user "tmt[provision-virtual]"
195+
196+
- name: Create folder to save disk image
197+
run: mkdir -p target
198+
199+
- name: Download disk.raw
200+
uses: actions/download-artifact@v4
201+
with:
202+
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
203+
path: target
204+
205+
- name: Workaround https://github.com/teemtee/testcloud/issues/18
206+
run: sudo rm -f /usr/bin/chcon && sudo ln -sr /usr/bin/true /usr/bin/chcon
207+
208+
- name: Run all TMT tests
209+
run: |
210+
just test-tmt-nobuild
211+
212+
- name: Archive TMT logs
213+
if: always()
214+
uses: actions/upload-artifact@v4
215+
with:
216+
name: tmt-log-PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-${{ matrix.tmt_plan }}
217+
path: /var/tmp/tmt

.github/workflows/integration.yml

Lines changed: 0 additions & 109 deletions
This file was deleted.

ci/clean-gha-runner.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)