[PATCH i-g-t] .gitlab-ci: Add explaination to run CI locally

Louis Chauvet louis.chauvet at bootlin.com
Wed Jul 10 13:22:12 UTC 2024


Currently, the CI can only be run on the mailing list. To avoid flooding
because of error in certain configurations, add a new .gitlab-ci-local.yml
file and some explanation to run some part of the CI locally.

Added some instruction in CONTRIBUTING.md to explain how to use this new
pipeline locally.

---
The "normal" .gitlab-ci.yml can't be used as it uses prebuild docker
images, only available for gitlab runners.

I did not include any debian build as I was not able to rebuild the docker
images.
---
 .gitlab-ci-local.yml | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 CONTRIBUTING.md      | 16 +++++++++
 2 files changed, 115 insertions(+)

diff --git a/.gitlab-ci-local.yml b/.gitlab-ci-local.yml
new file mode 100644
index 000000000000..21d4468379c8
--- /dev/null
+++ b/.gitlab-ci-local.yml
@@ -0,0 +1,99 @@
+image: igt-build-fedora
+variables:
+  BUILDAH_FORMAT: docker
+  BUILDAH_ISOLATION: chroot
+  MESON_OPTIONS: >
+    -Dlibdrm_drivers=intel,nouveau,amdgpu
+    -Doverlay=enabled
+    -Dchamelium=enabled
+    -Dvalgrind=enabled
+    -Dman=enabled
+    -Dtests=enabled
+    -Drunner=enabled
+    -Dlibunwind=enabled
+  LANG: "C.UTF-8"
+
+stages:
+  - build
+  - test
+
+#################### BUILD #########################
+
+build:tests-fedora:
+  stage: build
+  script:
+    - meson --prefix=/opt/igt $MESON_OPTIONS build
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
+    - DESTDIR="$PWD/installdir" ninja -C build install
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} igt-gpu-tools-doc
+  artifacts:
+    paths:
+      - build
+      - installdir
+
+build:tests-fedora-no-libunwind:
+  stage: build
+  script:
+    - dnf remove -y libunwind-devel
+    - meson -Dlibunwind=disabled build
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
+
+# documentation building is different with meson<0.47
+build:tests-fedora-oldest-meson:
+  stage: build
+  script:
+    - dnf remove -y meson
+    - pip install /usr/src/meson-*.tar.gz
+    - meson $MESON_OPTIONS build
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} igt-gpu-tools-doc
+
+# ensure igt_nouveau stubs build when nouveau support for libdrm is disabled
+build:tests-fedora-no-libdrm-nouveau:
+  stage: build
+  script:
+    - meson -Dlibdrm_drivers= build
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
+
+build:tests-fedora-clang:
+  stage: build
+  variables:
+    CC: clang
+  script:
+    - meson $MESON_OPTIONS build
+    - ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
+  artifacts:
+    paths:
+      - build
+
+
+test:ninja-test:
+  retry: 2
+  dependencies:
+    - build:tests-fedora
+  stage: test
+  script: meson test -C build --num-processes ${FDO_CI_CONCURRENT:-4}
+
+test:ninja-test-clang:
+  retry: 2
+  dependencies:
+    - build:tests-fedora-clang
+  variables:
+    CC: clang
+  stage: test
+  script: meson test -C build --num-processes ${FDO_CI_CONCURRENT:-4}
+
+test:list-undocumented-tests:
+  dependencies:
+    - build:tests-fedora
+  stage: test
+  script: .gitlab-ci/list_undocumented_tests.py build/tests/test-list.txt > undocumented_tests.txt
+  artifacts:
+    paths:
+      - undocumented_tests.txt
+
+test:verify-blacklists:
+  dependencies:
+    - build:tests-fedora
+  stage: test
+  script: for bl in tests/intel-ci/blacklist{,-pre-merge}.txt; do scripts/verify-blacklist.sh build/runner/igt_runner build/tests "$bl" || exit 1; done
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2ab8a48f6ae9..721fc6035b77 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -78,6 +78,22 @@ Sending Patches
 - Changes to the testcases are automatically tested. Take the results into
   account before merging.
 
+- When pushing a new series, your series will be build-tested by the CI. It is
+  useful to avoid merging broken stuff. You can run this CI locally by using the
+  project https://github.com/firecow/gitlab-ci-local. To install it, please
+  refer to its README (on debian, the package gitlab-ci-local can be used).
+
+  To run the CI, you need to build docker images:
+
+    docker build . -f Dockerfile.build-fedora -t igt-build-fedora:latest
+
+  Now you should be able to run the CI:
+
+    gitlab-ci-local --file .gitlab-ci-local.yml
+
+  If you want to run a specific stage, you can add it to the command line:
+
+    gitlab-ci-local --file .gitlab-ci-local.yml <stage>
 
 Commit Rights
 -------------

---
base-commit: f48806ee249015e967bb220eba8559c5e829d609
change-id: 20240710-gitlab-ci-local-2751f8c4f26c

Best regards,
-- 
Louis Chauvet <louis.chauvet at bootlin.com>



More information about the igt-dev mailing list