]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
ci: Use mkosi sandbox to run the integration tests 3402/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Jan 2025 19:21:03 +0000 (20:21 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Jan 2025 13:11:18 +0000 (14:11 +0100)
Using mkosi sandbox allows all the tools for the test logic themselves
to be executed from the tools tree as well.

.github/workflows/ci.yml
mkosi.conf.d/40-tools/mkosi.conf [new file with mode: 0644]
mkosi.conf.d/40-tools/mkosi.conf.d/arch.conf
mkosi.conf.d/40-tools/mkosi.conf.d/azure-centos-fedora.conf
mkosi.conf.d/40-tools/mkosi.conf.d/debian-kali-ubuntu.conf
mkosi.conf.d/40-tools/mkosi.conf.d/fedora.conf
mkosi.conf.d/40-tools/mkosi.conf.d/opensuse.conf
tests/test_signing.py

index 068c532c8c2cdf3be470eaad62f04471cd702fd6..13a7ff95c827726f9ff910b16ef42b2c036c60b4 100644 (file)
@@ -153,12 +153,9 @@ jobs:
           sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash
           sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash
 
+      # Make sure the latest changes from the pull request are used.
       - name: Install
-        run: |
-          sudo apt-get update
-          sudo apt-get install python3-pytest lvm2 cryptsetup-bin btrfs-progs sqop
-          # Make sure the latest changes from the pull request are used.
-          sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi
+        run: sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi
         working-directory: ./
 
       - name: Configure
@@ -171,6 +168,8 @@ jobs:
           KernelCommandLine=systemd.default_device_timeout_sec=180
 
           [Build]
+          ToolsTree=default
+          ToolsTreeDistribution=${{ matrix.tools }}
           Environment=SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet"
 
           [Runtime]
@@ -205,22 +204,19 @@ jobs:
           done
 
       - name: Build tools tree
-        run: |
-          mkosi \
-            --directory "" \
-            --distribution ${{ matrix.tools }} \
-            --include mkosi-tools
+        run: sudo mkosi -f sandbox true
 
       - name: Build image
-        run: mkosi --distribution ${{ matrix.distro }} -f
+        run: sudo mkosi --distribution ${{ matrix.distro }} -f
 
       - name: Run integration tests
         run: |
-          sudo --preserve-env \
-              timeout -k 30 1h python3 -m pytest \
-              --tb=no \
-              --capture=no \
-              --verbose \
-              -m integration \
-              --distribution ${{ matrix.distro }} \
-              tests/
+          sudo mkosi sandbox \
+            timeout -k 30 1h \
+            python3 -m pytest \
+            --tb=no \
+            --capture=no \
+            --verbose \
+            -m integration \
+            --distribution ${{ matrix.distro }} \
+            tests/
diff --git a/mkosi.conf.d/40-tools/mkosi.conf b/mkosi.conf.d/40-tools/mkosi.conf
new file mode 100644 (file)
index 0000000..4eef1de
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Build]
+ToolsTreePackages=
+        gnupg
+        lvm2
index bde7df91ac74beb23c4e468cea061f383217098b..48805ca3c8b5fea98bfa2255fc139c081573e47f 100644 (file)
@@ -5,6 +5,8 @@ ToolsTreeDistribution=arch
 
 [Build]
 ToolsTreePackages=
+        cryptsetup
         mypy
         python-pytest
         ruff
+        sequoia-sop
index 7a9fd493e5dad9d8efb441f3cb3c2ae2b03a1ba3..a49ef929de5523bf38dc9c3f227433aa5df269f6 100644 (file)
@@ -7,5 +7,6 @@ ToolsTreeDistribution=|fedora
 
 [Build]
 ToolsTreePackages=
+        cryptsetup
         python3-mypy
         python3-pytest
index 027afcf6c4c5a65c0429c31f4e08e9770f523d59..85ebe3019c01fd6248e0f3ea84d113957ed0b0d2 100644 (file)
@@ -7,5 +7,8 @@ ToolsTreeDistribution=|ubuntu
 
 [Build]
 ToolsTreePackages=
+        cryptsetup-bin
+        fdisk
         mypy
         python3-pytest
+        sqop
index 0b6bd4a5a9adf6681a75e261d1e30268441e75cb..0ec19244c9e74151c9dccd6bf13c91e7c13a8b8e 100644 (file)
@@ -6,3 +6,4 @@ ToolsTreeDistribution=fedora
 [Build]
 ToolsTreePackages=
         ruff
+        sequoia-sop
index 966500e6812e87e2cbaa608f64afabca9bfd53bd..2a7cd1118e06ad172841046b3b3c5be21519c833 100644 (file)
@@ -5,6 +5,7 @@ ToolsTreeDistribution=opensuse
 
 [Build]
 ToolsTreePackages=
+        cryptsetup
         grub2 # TODO: Move to default tools tree when https://bugzilla.opensuse.org/show_bug.cgi?id=1227464 is resolved.
         mypy
         python3-pytest
index 4bcb2050e5be4c8baaa28edbe873db84a975e656..7b8f3e8047cc76c07bb3dcd3cf48e245dc1887c7 100644 (file)
@@ -14,11 +14,8 @@ pytestmark = pytest.mark.integration
 
 
 def test_signing_checksums_with_sop(config: ImageConfig) -> None:
-    if find_binary("sqop", root=config.tools) is None:
-        pytest.skip("Needs 'sqop' binary in tools tree PATH to perform sop tests.")
-
     if find_binary("sqop") is None:
-        pytest.skip("Needs 'sqop' binary in host system PATH to perform sop tests.")
+        pytest.skip("Need 'sqop' binary to perform sop tests.")
 
     with tempfile.TemporaryDirectory() as path, Image(config) as image:
         tmp_path = Path(path)