ci: Check meson format

Use check-meson from meta-phosh as of
eb1c7f3c602f93e50ba0f1b7da31c936c771a75c

Signed-off-by: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu>
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/798>
This commit is contained in:
Evangelos Ribeiro Tzaras
2025-10-28 13:50:08 +01:00
committed by Marge Bot
parent 7baa515707
commit 36fc47b663
2 changed files with 46 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ include:
- 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-definitions.yml'
- 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
- project: 'guidog/meta-phosh'
ref: '2aeb9bfe2b230ca3aeda8275e42c95f94f6723ca'
ref: 'eb1c7f3c602f93e50ba0f1b7da31c936c771a75c'
file: '/ci/phosh-common-jobs.yml'
- component: "gitlab.gnome.org/GNOME/citemplates/release-service@master"
inputs:
@@ -13,6 +13,7 @@ include:
stages:
- build
- test
- style-checks
- package
- test-package
- deploy
@@ -101,6 +102,11 @@ check-consistency:
stage: test
extends: .phosh-check-consistency
check-meson:
stage: style-checks
extends:
- .phosh-check-meson
package:deb-debian-trixie:arm64:
variables:
L5_DOCKER_IMAGE: debian:trixie

39
.gitlab-ci/check-meson Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
#
# Copyright (C) 2025 The Phosh developers
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Author: Guido Günther <agx@sigxcpu.org>
ret=0
TMPDIR=$(mktemp -d)
# We check files individually so we can print the diff:
while IFS= read -r -d '' file; do
if ! meson format -e --check-only "$file"; then
echo
echo "Meson file '${file}' needs reformat:"
meson format -e "$file" > "${TMPDIR}/meson.build"
diff -u "$file" "${TMPDIR}/meson.build"
rm -f "${TMPDIR}/meson.build"
ret=1
fi
done < <(find . -name '*.build' -not -path './subprojects/*' -print0)
if [ -n "$TMPDIR" ]; then
rmdir "${TMPDIR}"
fi
if [ $ret -ne 0 ]; then
cat <<EOF
To reformat all files run:
meson format -e --recursive --inplace
EOF
fi
exit $ret