Skip to content

Commit 9f20572

Browse files
authored
Merge pull request #5525 from cgwalters/revamp-buildsys
Add build+test infra mirroring bootc
2 parents f7767cc + 29222a1 commit 9f20572

File tree

19 files changed

+494
-44
lines changed

19 files changed

+494
-44
lines changed

.copr/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ srpm:
55
# if we have a git repo with remotes, fetch tags so `git describe` gives a nice NEVRA when
66
# building the RPM
77
if git remote | grep origin; then git fetch origin --tags; fi
8-
git submodule update --init --recursive
8+
if [ -d .git ]; then git submodule update --init --recursive; fi
99
# Our primary CI build goes via RPM rather than direct to binaries
1010
# to better test that path, including our vendored spec file, etc.
1111
make -C packaging -f Makefile.dist-packaging srpm

.dockerignore

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1-
.cosa
2-
target
3-
compose-cache/
1+
# Exclude everything by default, then include just what we need
2+
# Especially note this means that .git is not included, and not tests/
3+
# to avoid spurious rebuilds.
4+
*
5+
6+
# Autotools build files
7+
!Makefile*.am
8+
!Makefile-*.am
9+
!Makefile*.inc
10+
!Makefile.bindings
11+
!configure.ac
12+
!autogen.sh
13+
14+
# Generated C++/Rust bridge files (checked into git)
15+
!rpmostree-cxxrs.h
16+
!rpmostree-cxxrs.cxx
17+
!rpmostree-cxxrsutil.hpp
18+
19+
# Build configuration
20+
!buildutil/
21+
!build-aux/
22+
!m4/
23+
24+
# Source code
25+
!src/
26+
!rust/
27+
28+
# Rust build files
29+
!Cargo.toml
30+
!Cargo.lock
31+
!build.rs
32+
!.cargo/
33+
34+
# Git submodules (needed by autogen.sh)
35+
!libglnx/
36+
!libdnf/
37+
38+
# Build system integration
39+
!packaging/
40+
!ci/
41+
!.copr/
42+
43+
# Test data for integration tests
44+
!tests/
45+
46+
# Documentation (for man pages, etc.)
47+
!docs/
48+
!man/
49+
50+
# Shell completion
51+
!completion/
52+
53+
# API documentation generation
54+
!api-doc/
Lines changed: 71 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
1-
# Keep this in sync with the copy in bootc-dev/bootc
21
name: 'Bootc Ubuntu Setup'
32
description: 'Default host setup'
3+
inputs:
4+
libvirt:
5+
description: 'Install libvirt and virtualization stack'
6+
required: false
7+
default: 'false'
48
runs:
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
@@ -46,4 +61,41 @@ runs:
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
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Container Build CI Workflow
2+
#
3+
# Builds rpm-ostree from source in a container using the Dockerfile and Justfile.
4+
# This workflow follows the pattern established in bootc for containerized builds.
5+
name: Container Build
6+
7+
permissions:
8+
actions: read
9+
10+
on:
11+
push:
12+
branches: [main]
13+
pull_request:
14+
branches: [main]
15+
workflow_dispatch: {}
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
# Build container and run basic validation
26+
build-and-validate:
27+
runs-on: ubuntu-24.04
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
base_image:
32+
- name: fedora-42
33+
image: quay.io/fedora/fedora-bootc:42
34+
# TODO: Enable CentOS Stream 10 once tests support it
35+
# - name: centos-10
36+
# image: quay.io/centos-bootc/centos-bootc:stream10
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v5
41+
with:
42+
submodules: true
43+
44+
- name: Bootc Ubuntu Setup
45+
uses: ./.github/actions/bootc-ubuntu-setup
46+
47+
- name: Run validation
48+
run: |
49+
just validate
50+
51+
- name: Build container
52+
run: |
53+
set -xeuo pipefail
54+
just build --build-arg=base=${{ matrix.base_image.image }}
55+
56+
- name: Run container integration tests
57+
run: |
58+
just test-container-integration

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,28 @@ bin-unit-tests = []
134134
sanitizers = []
135135

136136
default = []
137+
138+
[lints]
139+
workspace = true
140+
141+
[workspace.lints.rust]
142+
# Absolutely must handle errors
143+
unused_must_use = "forbid"
144+
missing_debug_implementations = "deny"
145+
# Feel free to comment this one out locally during development of a patch.
146+
dead_code = "deny"
147+
148+
# We aren't using these yet
149+
# [workspace.lints.rust]
150+
# unsafe_code = "deny"
151+
# missing_docs = "deny"
152+
153+
[workspace.lints.clippy]
154+
disallowed_methods = "deny"
155+
# These should only be in local code
156+
dbg_macro = "deny"
157+
todo = "deny"
158+
# These two are in my experience the lints which are most likely
159+
# to trigger, and among the least valuable to fix.
160+
needless_borrow = "allow"
161+
needless_borrows_for_generic_args = "allow"

0 commit comments

Comments
 (0)