Commit Graph

200 Commits

Author SHA1 Message Date
Simon McVittie
3d3187bc24 Incorporate some lint checks into meson test
This will make it easier and more obvious for developers to run them
locally: I'm sure I'm not the only developer who had assumed that
`.gitlab-ci/` is private to the CI environment and inappropriate (or
perhaps even destructive) to run on a developer/user system.

The lint checks are automatically skipped (with TAP SKIP syntax) if we
are not in a git checkout, or if git or the lint tool is missing. They
can also be disabled explicitly with `meson test --no-suite=lint`,
which downstream distributions will probably want to do.

By default, most lint checks are reported as an "expected failure"
(with TAP TODO syntax) rather than a hard failure, because they do not
indicate a functional problem with GLib and there is a tendency for
lint tools to introduce additional checks or become more strict over
time. Developers can override this by configuring with `-Dwerror=true`
(which also makes compiler warnings into fatal errors), or by running
the test suite like `LINT_WARNINGS_ARE_ERRORS=1 meson test --suite=lint`.

One exception to this is tests/check-missing-install-tag.py, which is
checking a functionally significant feature of our build system, and
seems like it is unlikely to have false positives: if that one fails,
it is reported as a hard failure.

run-style-check-diff.sh and run-check-todos.sh are not currently given
this treatment, because they require search-common-ancestor.sh, which
uses Gitlab-CI-specific information to find out which commits are in-scope
for checking.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-07 13:57:03 +00:00
Philip Withnall
27fb6ffce2 Merge branch 'wip/smcv/reuse' into 'main'
reuse: Fix screen-scraping expression for version 2.x

See merge request GNOME/glib!3897
2024-02-07 13:03:12 +00:00
Simon McVittie
5d888bc7c2 reuse: Fix screen-scraping expression for version 2.x
reuse 2.1.0 outputs "files with ..." instead of "Files with ...",
but it's easy to accept both.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-07 12:38:25 +00:00
Philip Withnall
722805fd09 reuse: Update CI limits on files missing SPDX data
One more monotonic step on the way to full REUSE compliance.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #1415
2024-02-07 12:10:04 +00:00
Philip Withnall
eb19551ebe build: Add thorough test setup
This allows the tests to be run with `meson test --setup thorough` and
it will run all the GTest tests with `-m thorough`.

Since this argument isn’t supported by the Python tests, it’s not passed
to them.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 17:22:09 +00:00
Philip Withnall
020ebe42f9 build: Change default for -Dman-pages from disabled to auto
Previously, `-Dman=false` was the default, because the generated man
pages were shipped in the distribution tarball already, so the option
actually mostly controlled whether to *re*build them.

The generated pages are no longer shipped in the tarball (and probably
haven’t been since the port to Meson, though I haven’t checked), so it
makes sense to change the default to encourage building the man pages if
the right tooling (`rst2man`) is available.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-21 16:13:03 +00:00
Philip Withnall
25f662bdc3 ci: Add missing SPDX header to check-missing-install-tag.py
Using the git history.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-18 14:56:40 +00:00
Philip Withnall
78c94d81ed ci: Build with introspection enabled
In most CI builds. (Not all of them, though, so we can also test the
build works with it disabled.)

This is needed for the upcoming libgirepository tests, as they need some
GIR files to test against.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
2023-12-12 16:58:26 +00:00
Philip Withnall
71061fdcb3 ci: Re-add explicit Meson version to Alpine CI image
Alpine 3.19 ships with Meson 1.3.0, which has broken handling of File
objects and their paths. This causes (as far as I can tell)
un-work-around-able breakage of GLib’s build.

See https://github.com/mesonbuild/meson/issues/5273#issuecomment-1851811417

That should be fixed in Meson 1.4.0, but that might not be released for
a while. Because we’re here to test GLib, not Meson, let’s pin the Meson
version in the Alpine CI image to 1.2.3, which we know works and is
reasonably up to date (and is what the other CI images use).

Fixes this CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/3361388

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-12 11:27:03 +00:00
Pablo Correa Gómez
e07294e569
ci: update alpine CI container to 3.19
And be more specific with version just in case.
2023-12-08 17:27:06 +01:00
Philip Withnall
5a273556df ci: Install correct version of Meson on Alpine CI image
The `latest` Alpine release contains Meson 1.1.0, but GLib depends on
1.2.0.

This should fix https://gitlab.gnome.org/GNOME/glib/-/jobs/3343347

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-05 15:55:11 +00:00
Jordan Williams
f341a37fb9
Install the packaging module on Windows 2023-12-05 09:10:33 -06:00
Jordan Williams
6ef967a0f9 Switch from the deprecated distutils module to the packaging module
The distutils module was removed in Python 3.12.
2023-12-05 14:18:10 +00:00
Philip Withnall
26f70e7605 ci: Remove unused variable from run-style-check-diff.sh
This was forgotten in commit c2e21a8164.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-28 23:45:22 +00:00
Philip Withnall
bfa2f9091f ci: Fix printing info message at end of run-style-check-diff.sh
The changes in commit 95479256df didn’t
completely work (or some other change has broken them since): the
informational message at the end of the script is now not printed.

Fix that by stopping bash exiting immediately if the subshell exits, by
using it in a boolean expression.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-28 23:43:33 +00:00
Philip Withnall
df4aea7620 gdatetime: Add support for %E modifier to g_date_time_format()
The `%E` modifier causes dates to be formatted using an alternative era
representation for years. This doesn’t do anything for most dates, but
in locales such as Thai and Japanese it causes years to be printed using
era names.

In Thai, this means the Thai solar calendar
(https://en.wikipedia.org/wiki/Thai_solar_calendar). In Japanese, this
means Japanese era names
(https://en.wikipedia.org/wiki/Japanese_era_name).

The `%E` modifier syntax follows what’s supported in glibc — see
nl_langinfo(3).

Supporting this is quite involved, as it means loading the `ERA`
description from libc and parsing it.

Unit tests are included.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3119
2023-11-28 19:32:02 +00:00
Pablo Correa Gómez
8901ffeffe
ci: add muslc CI 2023-11-12 15:39:14 +01:00
Philip Withnall
24a3e728ce build: Bump Meson dependency to 1.2.0
And update all the CI builds to use the latest micro release from that
series, 1.2.3.

This version bump means we can:
 - Drop some backwards-compatibility Meson checks
 - Fix a periodic CI failure caused by a now-fixed Meson bug
   (https://github.com/mesonbuild/meson/pull/10633)

It’s in line with our [Meson version policy](./docs/meson-version.md),
as Meson 1.2.1 is available in
[Debian Trixie](https://packages.debian.org/source/trixie/meson) and the
[freedesktop SDK](c95902f2ed/elements/components/meson.bst).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-10-24 17:00:24 +01:00
Philip Withnall
4b9ec32b26 ci: Remove some duplicate packages from an install list
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-22 22:10:07 +01:00
Philip Withnall
afd8dde13f gdatetime: Fix incorrect alt-digits being used after changing locale
The alt-digits are loaded from `nl_langinfo()` in a `GOnce` section,
which means `nl_langinfo()` is not re-queried after the process changes
locale (if that happens).

So, change the `GOnce` to a mutex and store the locale of the alt-digits
alongside them. This will introduce contention when calling
`format_number()` is called, but how often are multiple threads trying
to format dates at the same time?

If this does get highlighted as a performance problem, the other
approach I considered was a `GPrivate` struct containing all the
locale-specific cached data. That comes at the cost of using a
`GPrivate` slot (although that’s only particularly expensive on Windows,
and the locale code is quite different for Windows, so perhaps that
could be avoided entirely). It does mean that all locale printing could
be lock-free and still safely update cached data on a locale change.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-22 22:10:07 +01:00
Michael Catanzaro
58b66f3d6b Merge branch 'clang-format-14' into 'main'
ci: Update from clang-format-11 to clang-format-14

See merge request GNOME/glib!3646
2023-10-17 14:13:56 +00:00
Philip Withnall
47fc75155c ci: Update from clang-format-11 to clang-format-14
Since upgrading to Debian Bookworm in 13c359536, `clang-format-14` is
what’s available in the CI image.

This should fix the style-check-advisory CI job.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-17 10:13:50 +01:00
Luca Bacci
ee4aaed516 CI: Enable --Werror in MSYS2 CLANG64 job 2023-10-16 15:02:18 +02:00
Philip Withnall
d96695fef9 fixup! ci: Upgrade CI images to the new oldest-supported OS versions
This was accidentally missed out of the above commit, due to pushing
a new version of the image to test, without also pushing the git branch.
2023-10-11 16:34:20 +01:00
Matthias Clasen
39e9ef54be docs: Add initial support for using gi-docgen for docs
The files here are copied from the docs-gtk-org
branch of gtk.

This adds gi-docgen to the CI Dockerfiles and ensures the new versions
(including the OS upgrades from the previous commit) are used during CI.

Helps: #3037
2023-10-11 14:01:28 +01:00
Philip Withnall
13c3595363 ci: Upgrade CI images to the new oldest-supported OS versions
That means Debian Bookworm and Fedora 37.

Also rework the mingw Dockerfile to be based on the Fedora one, so that
the underlying layers can be shared. This should reduce the disk
consumption of the registry a little.

`.gitlab-ci.yml` has not been updated to use the new images in this
commit, as the images will be modified further in the following commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-10-11 13:54:13 +01:00
Emmanuele Bassi
9723c5595c ci: Use meson compile rather than bare ninja
This makes it more consistent with `meson setup` in the rest of the
file.
2023-08-16 13:07:05 +01:00
René de Hesselle
0c73ff3a08 meson: Use 'meson setup' to configure
This removes a deprecation warning when using 'meson' without 'setup'.
2023-08-16 13:06:40 +01:00
Philip Withnall
5370df540c ci: Use Meson 1.0.0 on Windows and macOS CI builds
This is a departure from our policy of using the minimum required Meson
version, but I think it might be worth a try to see if it fixes the
persistent intermittent build failures on these platforms due to what
looks like build dependency graph issues.

For example:
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2579411
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2578792
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2579220
 - https://gitlab.gnome.org/pwithnall/glib/-/jobs/2588507

I was looking at trying to diagnose some of these failures in order to
potentially file bugs against Meson, but the first step is really to
test against the latest version of Meson. So here we are.

Crucially, our other CI jobs continue to use the minimum Meson version
required by GLib, so we continue to test that GLib builds with its
minimum dependencies. I do not plan to change that.

Also crucially, this MR continues to use a specific Meson version,
rather than asking `pip` to install the latest available. Doing that
could lead to unexpected regressions in future, and that’s not what
GLib’s CI is meant to be testing for.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 13:34:59 +00:00
Marco Trevisan (Treviño)
a8f56c5be1 ci: Use verbose output in meson by default
Now that we're using TAP parsing, this will show subtest failures in
details but without showing any logging error, that we'd still need to parse
from actual logs.
2023-01-20 15:41:17 +01:00
Nirbheek Chauhan
fc6843bec8 ci: Fix podman support in run-docker.sh
In newer Fedora versions, `docker` doesn't exist. You have to use
`podman`.
2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
a587212080 ci: Update docker image generation README 2022-12-31 05:13:10 +05:30
Philip Withnall
42e810e2c1 ci: Don’t fail if testlog-unstable_tests.junit.xml doesn’t exist on MSVC
That file is created if running the `unstable_tests` suite succeeds. It
can fail, though, leaving that log file nonexistent. There’s no point in
failing the whole test run by bailing out if postprocessing the log file
fails.

Occasionally postprocessing can fail with a `FileNotFoundError`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-08 15:27:24 +00:00
Philip Withnall
3fad4d45bf Revert "build: Bump Meson dependency to 0.64.0"
This reverts commit 91f14cd058.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:10:07 +00:00
Philip Withnall
91f14cd058 build: Bump Meson dependency to 0.64.0
It will fix dependency ordering issues found in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917#note_1559190.

As per `docs/meson-version.md`, we can depend on Meson ≤0.64.0 now as
it’s in Debian Testing.

The FreeBSD runners have to be changed to explicitly install the right
version of Meson using `pip3`, as the system-installed version is not
quite new enough. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1596257.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: !2917
2022-11-23 10:39:13 +00:00
Philip Withnall
e960529532 ci: Exclude copylibs and fuzz tests from code coverage
The fuzz tests are run on a separate CI system, and we don’t care what
their code coverage is. The only reason they’re run on our CI systems at
all is as a smokecheck. They are not unit tests that we want to check
are running every line.

Similarly, exclude copylibs/subprojects as GLib is not responsible for
testing them. They have (or should have) their own unit tests and code
coverage metrics in their upstreams.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 14:56:34 +00:00
Philip Withnall
b906d470c7 ci: Add a CI check for REUSE-compliant licensing/copyright headers
This doesn’t enforce licensing/copyright headers to be present on all
files, but does check that at least a minimum number of files are
correct.

This should help avoid new files being added without appropriate
licensing information in future.

The baseline is set at what `reuse lint` outputs for me at the moment.

See https://reuse.software/tutorial/#step-2 for information about how to
add REUSE-compliant licensing/copyright to files.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-11-08 15:50:59 +00:00
Philip Withnall
cbf17c9422 Merge branch 'wip/3v1n0/support-can-fail-tests' into 'main'
meson, ci: Support tests that can fail under certain conditions

See merge request GNOME/glib!2987
2022-10-31 14:28:02 +00:00
Marco Trevisan (Treviño)
94273b0ebf ci: Remove not-printable chars from generated junit file
Under windows we get some invalid chars that are causing gitlab not to
be able to parse the xml files

See: https://github.com/mesonbuild/meson/issues/9894
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
3d497b8f5b ci: Show commands run from the test scripts
It allows better debugging in case of failures.
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
8d5ae3ae83 ci: Mark failing mingw tests as can-fail and do not ignore test failures 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
54a9e797fe ci: Mark failing windows tests as can-fail and do not ignore test failures 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
62dca6c1cf meson, ci: Support tests that can fail under certain conditions
We have tests that are failing in some environments, but it's
difficult to handle them because:
 - for some environments we just allow all the tests to fail: DANGEROUS
 - when we don't allow failures we have flacky tests: A CI pain

So, to avoid this and ensure that:
 - New failing tests are tracked in all platforms
 - gitlab integration on tests reports is working
 - coverage is reported also for failing tests

Add support for `can_fail` keyword on tests that would mark the test as
part of the `failing` test suite.
Not adding the suite directly when defining the tests as this is
definitely simpler and allows to define conditions more clearly (see next
commits).

Now, add a default test setup that does not run the failing and flaky tests
by default (not to bother distributors with testing well-known issues) and
eventually run all the tests in CI:
 - Non-flaky tests cannot fail in all platforms
 - Failing and Flaky tests can fail

In both cases we save the test reports so that gitlab integration is
preserved.
2022-10-31 14:08:29 +01:00
Marco Trevisan (Treviño)
e320149c39 ci: Add an msys2-clang64 job to run only on schedules
It has enough particularities to require a job to monitor failures
2022-10-31 12:00:53 +01:00
Marco Trevisan (Treviño)
345fbe0666 ci/test-msys2: use $MINGW_PACKAGE_PREFIX 2022-10-31 12:00:53 +01:00
Marco Trevisan (Treviño)
fdaa8a334a ci: Set CFLAGS on msys2-mingw32 in yaml file as it happens for other jobs
Be consistent, and based on this also perform the lcov job or not
2022-10-31 12:00:53 +01:00
Emmanuel Fleury
da178b1938 Fix coding style issue in .gitlab-ci/check-missing-install-tag.py 2022-10-27 09:51:28 +02:00
Xavier Claessens
a4eb39dde8 ci: Fix failing tests not failing CI job 2022-10-26 11:55:56 -04:00
Xavier Claessens
9ba01dc7fc ci: Fix check for missing install tag
Better check the installation plan json file instead of parsing logs.
2022-10-26 11:55:56 -04:00
Emmanuele Bassi
8f975d07f3 ci: Conform to Python's coding style
The check-missing-install-tag.py script breaks PEP8, and the style check
CI job complains about it.
2022-09-25 18:51:22 +01:00