Commit 028a590a authored by Olivier Fourdan's avatar Olivier Fourdan 🛠
Browse files

ci: Add gitlab CI



A simple CI to make sure it builds.

TODO: Would be nice to add testing, e.g. spawning weston to run the
generated wayland-info binary.
Signed-off-by: Olivier Fourdan's avatarOlivier Fourdan <ofourdan@redhat.com>
parent 31e03a1d
Pipeline #467140 failed with stages
in 1 minute and 26 seconds
#####################################################
# #
# THIS FILE IS GENERATED, DO NOT EDIT! #
# #
# Generated with "ci-fairy generate-template", edit #
# .gitlab-ci/ci.template and .gitlab-ci/config.yml #
# and rerun "ci-fairy generate-template" to change #
# this file. #
# #
#####################################################
.templates_sha: &template_sha 3d03cccd770c04e63b40325b42223495274d6a1d
include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file:
- '/templates/ci-fairy.yml'
- '/templates/fedora.yml'
stages:
- sanity check
- prep
- build
variables:
FDO_UPSTREAM_REPO: wayland/wayland-utils
MESON_BUILDDIR: "builddir"
NINJA_ARGS: ''
MESON_ARGS: ''
MESON_TEST_ARGS: ''
GIT_DEPTH: 1
.policy:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
# cancel run when a newer version is pushed to the branch
interruptible: true
# Re-generate the CI script and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script, see
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
#
check-ci-script:
extends:
- .fdo.ci-fairy
stage: sanity check
script:
- ci-fairy generate-template --verify && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1
#
# Verify that commit messages are as expected, signed-off, merge request
# allows collaboration, etc.
#
check-commit:
extends:
- .fdo.ci-fairy
stage: sanity check
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: never
script:
- ci-fairy check-commits --signed-off-by --junit-xml=results.xml
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
.fedora.34:
variables:
FDO_DISTRIBUTION_VERSION: '34'
FDO_DISTRIBUTION_TAG: '2021-12-14.1'
FDO_DISTRIBUTION_EXEC: "bash -x .gitlab-ci/build-deps.sh"
prep-fedora-34:
extends:
- .fdo.container-build@fedora
- .fedora.34
stage: prep
variables:
FDO_DISTRIBUTION_PACKAGES: "meson gcc"
build-fedora-34:
extends:
- .fdo.distribution-image@fedora
- .fedora.34
stage: build
script:
- .gitlab-ci/meson-build.sh
#!/bin/bash
# Builds the dependencies required for any OS/architecture combination.
set -o xtrace -o errexit
# Set concurrency to an appropriate level for our shared runners, falling back
# to the conservative default form before we had this variable.
export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}"
export NINJAFLAGS="-j${FDO_CI_CONCURRENT:-4}"
# wayland-info 9.0 requires libwayland >= 1.20
git clone https://gitlab.freedesktop.org/wayland/wayland.git --depth 1 --branch=1.20.0
cd wayland
meson _build -D{documentation,dtd_validation}=false
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf wayland
{# You're looking at the template here, so you can ignore the below
warning. This is the right file to edit #}
#####################################################
# #
# THIS FILE IS GENERATED, DO NOT EDIT! #
# #
# Generated with "ci-fairy generate-template", edit #
# .gitlab-ci/ci.template and .gitlab-ci/config.yml #
# and rerun "ci-fairy generate-template" to change #
# this file. #
# #
#####################################################
.templates_sha: &template_sha 3d03cccd770c04e63b40325b42223495274d6a1d
include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file:
- '/templates/ci-fairy.yml'
{% for d in distributions %}
- '/templates/{{d.name}}.yml'
{% endfor %}
stages:
- sanity check
- prep
- build
variables:
FDO_UPSTREAM_REPO: wayland/wayland-utils
MESON_BUILDDIR: "builddir"
NINJA_ARGS: ''
MESON_ARGS: ''
MESON_TEST_ARGS: ''
GIT_DEPTH: 1
.policy:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
# cancel run when a newer version is pushed to the branch
interruptible: true
# Re-generate the CI script and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script, see
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
#
check-ci-script:
extends:
- .fdo.ci-fairy
stage: sanity check
script:
- ci-fairy generate-template --verify && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1
#
# Verify that commit messages are as expected, signed-off, merge request
# allows collaboration, etc.
#
check-commit:
extends:
- .fdo.ci-fairy
stage: sanity check
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: never
script:
- ci-fairy check-commits --signed-off-by --junit-xml=results.xml
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
{% for d in distributions %}
.{{d.name}}.{{d.version}}:
variables:
FDO_DISTRIBUTION_VERSION: '{{d.version}}'
FDO_DISTRIBUTION_TAG: '{{d.tag}}'
FDO_DISTRIBUTION_EXEC: "bash -x .gitlab-ci/{{d.script}}"
prep-{{d.name}}-{{d.version}}:
extends:
- .fdo.container-build@{{d.name}}
- .{{d.name}}.{{d.version}}
stage: prep
variables:
FDO_DISTRIBUTION_PACKAGES: "{{' '.join(d.packages)}}"
build-{{d.name}}-{{d.version}}:
extends:
- .fdo.distribution-image@{{d.name}}
- .{{d.name}}.{{d.version}}
stage: build
script:
- .gitlab-ci/meson-build.sh
{% endfor %}
.default_tag: &default_tag '2021-12-14.1'
distributions:
- name: fedora
tag: *default_tag
version: 34
script: build-deps.sh
packages:
- meson
- gcc
#!/bin/bash
if [[ -f .meson_environment ]]; then
. .meson_environment
fi
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR undefined."
exit 1
fi
# emulate a few gitlab variables to make it easier to
# run and debug locally.
if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]] || [[ -z "$CI_PROJECT_NAME" ]]; then
echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME".
CI_PROJECT_NAME=$(basename $PWD)
CI_JOB_ID=$(date +%s)
CI_JOB_NAME='${CI_PROJECT_NAME}-job-local'
echo "Simulating gitlab environment: "
echo " CI_JOB_ID=$CI_JOB_ID"
echo " CI_JOB_NAME=$CI_JOB_NAME"
echo " CI_PROJECT_NAME=$CI_PROJECT_NAME"
fi
echo "*************************************************"
echo "builddir: $MESON_BUILDDIR"
echo "meson args: $MESON_ARGS"
echo "ninja args: $NINJA_ARGS"
echo "meson test args: $MESON_TEST_ARGS"
echo "*************************************************"
set -e
rm -rf "$MESON_BUILDDIR"
meson "$MESON_BUILDDIR" $MESON_ARGS
meson configure "$MESON_BUILDDIR"
ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
if [[ -z "$MESON_TEST_ARGS" ]]; then
exit 0
fi
# we still want to generate the reports, even if meson test fails
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
exit_code=$?
exit $exit_code
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment