Meson Project Example

CI powered by ci-multiplatform

In the directory examples/meson you can find a basic setup for integrating ci-multiplatform with your Meson project (sources on GitLab.com and FDO).

All available templates are utilized here, including the oci template, which customizes the base image. This example assumes you are using GitLab.com native runners for a subset of supported architectures.

Meson project

The example Meson project uses the official Meson tutorial as a starting point. You can refer to the official tutorial for more details on configuring and building your project.

This project features a custom envlib library, which demonstrates how environment variables can affect application behavior. The library uses the CUSTOM_ENV_VAR variable to alter its functionality. In the Test Stage, this variable is set within the job matrix, showcasing how environment variables can be configured for different test scenarios.

Pipeline Structure

The CI stages are organized into separate files in the .gitlab-ci.d directory. This design improves maintainability and compartmentalizes stages, making it easier to customize workflows using job inputs.

OCI Image Stage

The OCI image build process is specified in .gitlab-ci.d/oci/oci.yml. It creates an OCI image based on the pre-built llvm-meson image, adding any additional dependencies required for the project. Both the template and Containerfile are organized in a dedicated directory (.gitlab-ci.d/oci), streamlining the use of workflow.rules for detecting file changes in merge requests and minimizing variability in the OCI context.

Build Stage

The build stage, defined in .gitlab-ci.d/build.yml and included in .gitlab-ci.yml, compiles the Meson project for multiple platforms (linux-native-amd64, linux-native-arm64-v8, linux-native-ppc64le, linux-native-riscv64, windows-cross-amd64) using both GNU and LLVM toolchains.

Test Stage

The test stage executes the project’s tests across all supported architectures and toolchains, using the same targets as the build stage. Its configuration resides in .gitlab-ci.d/test.yml and is included in .gitlab-ci.yml.

Summary Stage

The summary stage, defined in .gitlab-ci.d/summary.yml, aggregates coverage reports from all test jobs and generates unified Cobertura XML and HTML reports for GitLab CI visualization. It merges coverage data across architectures, enabling a comprehensive view of test coverage in the pipeline.