gitlab-ci.yml: Run test with KVM and macOS via cirrus-run
Since Travis changed their policy, we soon cannot use it for the
kvm-unit-tests anymore, thus we lose the CI testing with KVM enabled
and the compilation jobs on macOS. Fortunately there is an alternative:
Cirrus-CI also provides containers with KVM enabled and CI jobs with
macOS. Thanks to the so-call "cirrus-run" script, we can even start
the jobs from the gitlab-CI, so we get all the test coverage in the
gitlab-CI again. cirrus-run needs some configuration first, though.
Please refer to the description from libvirt for the details how to
set up your environment for these jobs:
https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst
Message-Id: <20210115223017.271339-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6613c7b..8834e59 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -122,3 +122,34 @@
setjmp sieve tsc rmap_chain umip
| tee results.txt
- grep -q PASS results.txt && ! grep -q FAIL results.txt
+
+# Cirrus-CI provides containers with macOS and Linux with KVM enabled,
+# so we can test some scenarios there that are not possible with the
+# gitlab-CI shared runners. We use the "cirrus-run" container from the
+# libvirt project to start the jobs. See the following URL for more
+# information how to set up your environment to use these containers:
+#
+# https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst
+#
+.cirrus_build_job_template: &cirrus_build_job_definition
+ image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
+ before_script:
+ - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
+ -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
+ -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
+ < ci/$CI_JOB_NAME.yml > ci/_$CI_JOB_NAME.yml
+ script:
+ - cirrus-run -v --show-build-log always ci/_$CI_JOB_NAME.yml
+ only:
+ variables:
+ - $CIRRUS_GITHUB_REPO
+ - $CIRRUS_API_TOKEN
+
+cirrus-ci-fedora:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-i386:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-x86-64:
+ <<: *cirrus_build_job_definition
diff --git a/ci/cirrus-ci-fedora.yml b/ci/cirrus-ci-fedora.yml
new file mode 100644
index 0000000..aba6ae7
--- /dev/null
+++ b/ci/cirrus-ci-fedora.yml
@@ -0,0 +1,65 @@
+
+fedora_task:
+ container:
+ image: fedora:latest
+ cpu: 4
+ memory: 4Gb
+ kvm: true
+ install_script:
+ - dnf update -y
+ - dnf install -y diffutils gcc git make qemu-system-x86
+ clone_script:
+ - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+ - git fetch origin "@CI_COMMIT_REF_NAME@"
+ - git reset --hard "@CI_COMMIT_SHA@"
+ script:
+ - mkdir build
+ - cd build
+ - ../configure
+ - make -j$(nproc)
+ - ./run_tests.sh
+ access
+ asyncpf
+ debug
+ emulator
+ ept
+ hypercall
+ hyperv_clock
+ hyperv_connections
+ hyperv_stimer
+ hyperv_synic
+ idt_test
+ intel_iommu
+ ioapic
+ ioapic-split
+ kvmclock_test
+ msr
+ pcid
+ pcid-disabled
+ rdpru
+ realmode
+ rmap_chain
+ s3
+ setjmp
+ sieve
+ smptest
+ smptest3
+ syscall
+ tsc
+ tsc_adjust
+ tsx-ctrl
+ umip
+ vmexit_cpuid
+ vmexit_inl_pmtimer
+ vmexit_ipi
+ vmexit_ipi_halt
+ vmexit_mov_from_cr8
+ vmexit_mov_to_cr8
+ vmexit_ple_round_robin
+ vmexit_tscdeadline
+ vmexit_tscdeadline_immed
+ vmexit_vmcall
+ vmx_apic_passthrough_thread
+ xsave
+ | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt
diff --git a/ci/cirrus-ci-macos-i386.yml b/ci/cirrus-ci-macos-i386.yml
new file mode 100644
index 0000000..b837101
--- /dev/null
+++ b/ci/cirrus-ci-macos-i386.yml
@@ -0,0 +1,36 @@
+
+macos_i386_task:
+ osx_instance:
+ image: catalina-base
+ install_script:
+ - brew install coreutils bash git gnu-getopt make qemu i686-elf-gcc
+ clone_script:
+ - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+ - git fetch origin "@CI_COMMIT_REF_NAME@"
+ - git reset --hard "@CI_COMMIT_SHA@"
+ script:
+ - export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+ - mkdir build
+ - cd build
+ - ../configure --arch=i386 --cross-prefix=i686-elf-
+ - gmake -j$(sysctl -n hw.ncpu)
+ - ACCEL=tcg ./run_tests.sh
+ cmpxchg8b
+ eventinj
+ realmode
+ setjmp
+ sieve
+ taskswitch
+ tsc
+ umip
+ vmexit_cpuid
+ vmexit_inl_pmtimer
+ vmexit_ipi
+ vmexit_ipi_halt
+ vmexit_mov_from_cr8
+ vmexit_mov_to_cr8
+ vmexit_ple_round_robin
+ vmexit_tscdeadline
+ vmexit_tscdeadline_immed
+ | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt
diff --git a/ci/cirrus-ci-macos-x86-64.yml b/ci/cirrus-ci-macos-x86-64.yml
new file mode 100644
index 0000000..dcb8f6d
--- /dev/null
+++ b/ci/cirrus-ci-macos-x86-64.yml
@@ -0,0 +1,41 @@
+
+macos_task:
+ osx_instance:
+ image: catalina-base
+ install_script:
+ - brew install coreutils bash git gnu-getopt make qemu x86_64-elf-gcc
+ clone_script:
+ - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+ - git fetch origin "@CI_COMMIT_REF_NAME@"
+ - git reset --hard "@CI_COMMIT_SHA@"
+ script:
+ - export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+ - mkdir build
+ - cd build
+ - ../configure --cross-prefix=x86_64-elf-
+ - gmake -j$(sysctl -n hw.ncpu)
+ - ACCEL=tcg ./run_tests.sh
+ eventinj
+ intel_iommu
+ ioapic-split
+ msr
+ realmode
+ rmap_chain
+ setjmp
+ sieve
+ smptest
+ smptest3
+ syscall
+ tsc
+ umip
+ vmexit_cpuid
+ vmexit_inl_pmtimer
+ vmexit_ipi
+ vmexit_ipi_halt
+ vmexit_mov_from_cr8
+ vmexit_mov_to_cr8
+ vmexit_ple_round_robin
+ vmexit_tscdeadline
+ vmexit_tscdeadline_immed
+ | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt