test: add cross-build end-to-end test
This commit uses the new `build --arch=` support to perform a cross arch build for aarch64, ppc64le, riscv64, s390x on fedora. We could do also centos-9 each arch is already 20min.
This commit is contained in:
parent
8e6a6673f5
commit
cd1b5bae64
3 changed files with 30 additions and 0 deletions
2
.github/workflows/pytest.yaml
vendored
2
.github/workflows/pytest.yaml
vendored
|
|
@ -34,6 +34,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y python3-pytest golang
|
sudo apt install -y python3-pytest golang
|
||||||
|
- name: Install cross build dependencies
|
||||||
|
run: sudo apt install -y qemu-user-static
|
||||||
|
|
||||||
- name: Run integration tests via pytest
|
- name: Run integration tests via pytest
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ RUN CGO_ENABLED=0 go build -tags "containers_image_openpgp exclude_graphdriver_b
|
||||||
|
|
||||||
FROM registry.fedoraproject.org/fedora:41
|
FROM registry.fedoraproject.org/fedora:41
|
||||||
|
|
||||||
|
# podman mount needs this
|
||||||
|
RUN mkdir -p /etc/containers/networks
|
||||||
# Fast-track osbuild so we don't depend on the "slow" Fedora release process to implement new features in bib
|
# Fast-track osbuild so we don't depend on the "slow" Fedora release process to implement new features in bib
|
||||||
RUN dnf install -y dnf-plugins-core \
|
RUN dnf install -y dnf-plugins-core \
|
||||||
&& dnf copr enable -y @osbuild/osbuild \
|
&& dnf copr enable -y @osbuild/osbuild \
|
||||||
|
|
|
||||||
|
|
@ -96,3 +96,29 @@ def test_container_with_progress(tmp_path, build_fake_container, progress, needl
|
||||||
], text=True)
|
], text=True)
|
||||||
assert needle in output
|
assert needle in output
|
||||||
assert forbidden not in output
|
assert forbidden not in output
|
||||||
|
|
||||||
|
|
||||||
|
# only test a subset here to avoid overly long runtimes
|
||||||
|
@pytest.mark.parametrize("arch", ["aarch64", "ppc64le", "riscv64", "s390x"])
|
||||||
|
def test_container_cross_build(tmp_path, build_container, arch):
|
||||||
|
# this is only here to speed up builds by sharing downloaded stuff
|
||||||
|
# when this is run locally (we could cache via GH action though)
|
||||||
|
os.makedirs("/var/cache/image-builder/store", exist_ok=True)
|
||||||
|
output_dir = tmp_path / "output"
|
||||||
|
output_dir.mkdir()
|
||||||
|
subprocess.check_call([
|
||||||
|
"podman", "run",
|
||||||
|
"--privileged",
|
||||||
|
"-v", "/var/lib/containers/storage:/var/lib/containers/storage",
|
||||||
|
"-v", "/var/cache/image-builder/store:/var/cache/image-builder/store",
|
||||||
|
"-v", f"{output_dir}:/output",
|
||||||
|
build_container,
|
||||||
|
"build",
|
||||||
|
"--progress=verbose",
|
||||||
|
"--output-dir=/output",
|
||||||
|
"container",
|
||||||
|
"--distro", "fedora-41",
|
||||||
|
# selecting a foreign arch here automatically triggers a cross-build
|
||||||
|
f"--arch={arch}",
|
||||||
|
], text=True)
|
||||||
|
assert os.path.exists(output_dir / f"fedora-41-container-{arch}.tar")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue