Skip to contentSkip to conversation

Add cleanup checks to CI pipeline

PATCH Applied Richard Weinberger 2 participants 7 messages Jun 29, 2024 – Jul 1, 2024

lore
Share & tools
lore
#0 lore raw

cover Add cleanup checks to CI pipeline

Run make clean after building kernel and Xenomai and check whether no stale files exist.
This allows also testing the --reverse feature of prepare-kernel.sh.

Since build artefacts are not used after building, at least as I understand the current pipelines, make clean can get executed right in the build stage.

Richard Weinberger (5):
gitlab-ci.yml: Use CI_PROJECT_DIR variable gitlab-ci.yml: Clean and check kernel build Refactor .gitignore file
doxygen: Remove generated config file up make clean gitlab-ci.yml: Clean and check xenomai build

 .gitignore              | 56 +++++++++++++++++++++++++++++------------
 .gitlab-ci.yml          | 11 +++++---
 doc/doxygen/Makefile.am |  1 +
 3 files changed, 48 insertions(+), 20 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/5 gitlab-ci.yml: Use CI_PROJECT_DIR variable

Using CI_PROJECT_DIR we can reduce the amount of directory changes and configure the kernel relative to the Xenomai project directory.

---
 .gitlab-ci.yml | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
.gitlab-ci.yml +2 -4
index fa9203525..c5c6c3a56 100644
@@ -70,7 +70,7 @@ variables:
     - export PATH=/usr/lib/ccache:$PATH
     - ${CROSS_COMPILE}gcc --version
   script:
-    - export CCACHE_DIR=$(pwd)/.ccache
+    - export CCACHE_DIR=${CI_PROJECT_DIR}/.ccache
     - pushd ${KDIR}
     - make -j $(nproc) ${KERNEL_DEFCONFIG}
     # Generic settings
@@ -168,9 +168,7 @@ variables:
     - ./scripts/config -e XENO_DRIVERS_SPI_SUN6I
     - ./scripts/config -e XENO_DRIVERS_SPI_OMAP2_MCSPI_RT
     - ./scripts/config -e XENO_DRIVERS_SPI_DEBUG
-    - popd
-    - scripts/prepare-kernel.sh --linux=${KDIR}
-    - pushd ${KDIR}
+    - ${CI_PROJECT_DIR}/scripts/prepare-kernel.sh
     - make -j $(nproc) olddefconfig
     - make -j $(nproc) all
     - popd
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/5 gitlab-ci.yml: Clean and check kernel build

In reply to Richard Weinberger

Make sure that after cleaning the build none of our changes are left behind.

---
 .gitlab-ci.yml | 3 +++
 1 file changed, 3 insertions(+)
.gitlab-ci.yml +3 -0
index c5c6c3a56..68e3ab324 100644
@@ -171,6 +171,9 @@ variables:
     - ${CI_PROJECT_DIR}/scripts/prepare-kernel.sh
     - make -j $(nproc) olddefconfig
     - make -j $(nproc) all
+    - make clean
+    - ${CI_PROJECT_DIR}/scripts/prepare-kernel.sh --reverse
+    - git status --short | grep . && exit 1
     - popd
     - scripts/bootstrap
     - ./configure ${CONFIGURE_OPTS}
Signature · 1 line
2.35.3
#3 lore raw

PATCH 3/5 Refactor .gitignore file

In reply to Richard Weinberger

Add C and autoconf specific artefacts.

---
 .gitignore | 56 ++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 16 deletions(-)
.gitignore +40 -16
index b1d682032..402604c59 100644
@@ -1,17 +1,41 @@
+# Regular C artifacts
+*.a
+*.la
+*.lo
+*.o
+*.s
+*.so
+
+# autoconf specific
+/aclocal.m4
+/autom4te.cache
+/config.log
+/config.status
+/config/compile
+/config/config.guess
+/config/config.sub
+/config/depcomp
+/config/install-sh
+/config/libtool.m4
+/config/ltmain.sh
+/config/ltoptions.m4
+/config/ltsugar.m4
+/config/ltversion.m4
+/config/lt~obsolete.m4
+/config/missing
+/configure
+/include/stamp-h?
+/libtool
+/include/xeno_config.h
+/include/xeno_config.h.in*
+/.ccache
+.deps
+.libs
+.dirstamp
+Makefile
 Makefile.in
-include/xeno_config.h.in*
-config/compile
-config/config.guess
-config/config.sub
-config/depcomp
-config/install-sh
-config/libtool.m4
-config/ltmain.sh
-config/ltoptions.m4
-config/ltsugar.m4
-config/ltversion.m4
-config/lt~obsolete.m4
-config/missing
-configure
-aclocal.m4
-autom4te.cache
+# They are part of AC_CONFIG_FILES
+/utils/net/rtnet
+/utils/net/rtnet.conf
+/scripts/xeno
+/scripts/xeno-config
Signature · 1 line
2.35.3
#4 lore raw

PATCH 4/5 doxygen: Remove generated config file up make clean

In reply to Richard Weinberger
---
 doc/doxygen/Makefile.am | 1 +
 1 file changed, 1 insertion(+)
doc/doxygen/Makefile.am +1 -0
index 964dfdf44..c897fdcc0 100644
@@ -1,6 +1,7 @@
 HTML_DOCS = html/xeno3prm html/xeno3prm/search
 PDF_DOCS  = xeno3prm.pdf
 EXTRA_DIST = xeno3prm-common.conf.in xeno3prm-html.conf.in xeno3prm-latex.conf.in
+CLEANFILES = xeno3prm-common.conf xeno3prm-html.conf xeno3prm-latex.conf
 
 if XENO_BUILD_DOC
 
Signature · 1 line
2.35.3
#5 lore raw

PATCH 5/5 gitlab-ci.yml: Clean and check xenomai build

In reply to Richard Weinberger

Like for the kernel build, make sure make clean leaves no auto generated files behind.
If this check fails in future, either clean rules are missing or .gitignore patterns need an update.

---
 .gitlab-ci.yml | 2 ++
 1 file changed, 2 insertions(+)
.gitlab-ci.yml +2 -0
index 68e3ab324..0839da010 100644
@@ -178,6 +178,8 @@ variables:
     - scripts/bootstrap
     - ./configure ${CONFIGURE_OPTS}
     - make -j $(nproc)
+    - make clean
+    - git status --short | grep . && exit 1
     - ccache -s
   interruptible: true
   cache:
Signature · 1 line
2.35.3
Applied
#6 lore raw
In reply to Richard Weinberger
Quoted 14 lines · Richard Weinberger

Run make clean after building kernel and Xenomai and check whether no stale files exist.
This allows also testing the --reverse feature of prepare-kernel.sh.

Since build artefacts are not used after building, at least as I understand the current pipelines, make clean can get executed right in the build stage.

Richard Weinberger (5):
gitlab-ci.yml: Use CI_PROJECT_DIR variable gitlab-ci.yml: Clean and check kernel build Refactor .gitignore file
doxygen: Remove generated config file up make clean gitlab-ci.yml: Clean and check xenomai build

Quoted 5 lines
 .gitignore              | 56 +++++++++++++++++++++++++++++------------
 .gitlab-ci.yml          | 11 +++++---
 doc/doxygen/Makefile.am |  1 +
 3 files changed, 48 insertions(+), 20 deletions(-)

Thanks, applied.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center