monado/.gitlab-ci/ci.template

246 lines
6.2 KiB
Plaintext
Raw Normal View History

# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2023 Collabora, Ltd. and the Monado contributors
{# ignore the warning, this is actually the template to edit. #}
###############################################
# GENERATED - DO NOT EDIT
# see .gitlab-ci/ci.template, etc instead
###############################################
{# See README.md for instructions to regenerate after modification. #}
{#
useful links:
https://freedesktop.pages.freedesktop.org/ci-templates/
https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml
https://gitlab.freedesktop.org/freedesktop/ci-templates
Config file used for all templates: .gitlab-ci/config.yml
.gitlab-ci.yml template: .gitlab-ci/ci.template
.gitlab-ci/distributions template (for reprepro): .gitlab-ci/distributions.jinja
.gitlab-ci/reprepro.sh template: .gitlab-ci/reprepro.sh.jinja
The following will update all files from templates:
make -f .gitlab-ci/ci-scripts.mk
#}
# Detached MR pipelines, needed due to https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438
# workflow:
# rules:
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# - if: $CI_PIPELINE_SOURCE == 'push'
variables:
FDO_UPSTREAM_REPO: "monado/monado"
include:
- project: "freedesktop/ci-templates"
ref: {{fdo_ci_templates_sha}}
file:
{% for distro in distributions %}
- "/templates/{{distro.name}}.yml"
{% endfor %}
# - local: .gitlab-ci/containers/ci-container-prep.yml
- local: .gitlab-ci/ci-rules.yml
stages:
- container_prep
- build
- package
- reprepro
- pages
- deploy
###
# Extra rules for packaging
.monado.packaging.conditions:
rules:
# Only the default branch of the "upstream" repo.
- if: "$CI_PROJECT_PATH == $FDO_UPSTREAM_REPO && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH"
when: on_success
# Otherwise, don't build packages.
- when: never
2022-05-18 16:10:12 +00:00
{% include 'win_containers.yml' %}
{% include 'ci-containers-variables.yml.jinja' %}
{% include 'ci-containers.yml.jinja' %}
{% from 'functions.jinja' import base_job_to_use_image_containing, base_job_to_use_image with context %}
2022-05-18 16:10:12 +00:00
# Style check job
format-and-spellcheck:
extends:
- {{base_job_to_use_image_containing("codespell")}}
stage: build
script:
- scripts/format-and-spellcheck.sh
artifacts:
paths:
- patches/
expire_in: 1 week
when: on_failure
# Verify REUSE compliance
reuse:
extends:
- .build-rules
stage: build
image:
name: fsfe/reuse:latest
entrypoint: [""]
script:
- reuse lint
{% macro make_cmake_args(cmake_defines) %}
2023-11-14 17:28:02 +00:00
{% if cmake_defines is defined and cmake_defines %}
{%- for k, v in cmake_defines |dictsort %} -D{{ k }}={{ v }}{% endfor %}
{%- endif %}
{%- endmacro -%}
{#### Main build jobs ####}
{% for distro in distributions -%} {%- for image in distro.images if image.build_jobs -%} {%- for job in image.build_jobs %}
{{job.name}}:
stage: build
extends:
{% if job.name == documentation_build %}
- .monado.packaging.conditions
{% endif %}
- {{base_job_to_use_image(distro, image)}}
2022-01-25 19:35:31 +00:00
{%- if job.before_script or "android" in job.name %}
before_script:
2022-01-25 19:35:31 +00:00
{% endif %}
{% for line in job.before_script %}
- {{line}}
2022-01-25 19:35:31 +00:00
{% endfor %}
{%- if "android" in job.name %}
{# Keep this right below the before_script since this is an extra line!! #}
# For caching gradle stuff
- export GRADLE_USER_HOME=`pwd`/.gradlehome
variables:
GRADLE_ARGS: "-Porg.gradle.daemon=false "
cache:
paths:
- .gradlehome/wrapper
- .gradlehome/caches
{% endif %}
2022-01-25 19:35:31 +00:00
script:
- .gitlab-ci/prebuild.sh
{#- regular or NDK cmake builds -#}
2022-03-09 22:54:33 +00:00
{%- if "cmake" in job.name or "ndk" in job.name %}
- .gitlab-ci/ci-cmake-build.sh {{- make_cmake_args(job.cmake_defines) }}
2022-01-25 19:35:31 +00:00
{#- gradle builds -#}
{%- elif "android" in job.name %}
- .gitlab-ci/ci-gradle-build.sh {{ job.target }}
2022-01-25 19:35:31 +00:00
{%- else %}
{# error message #}
CANNOT GUESS JOB TYPE
{%- endif %}
{%- if "cmake" in job.name %}
- cd build && ctest --output-on-failure
{%- endif %}
{%- if job.artifact_path %}
artifacts:
paths:
- {{ job.artifact_path }}
{%- endif %}
{% endfor -%} {%- endfor -%} {%- endfor %}
2022-05-18 16:10:12 +00:00
# Windows build
windows:
stage: build
extends:
- .monado.image.windows
script:
2022-10-26 21:18:14 +00:00
- ./.gitlab-ci/windows/monado_build.ps1 -Install -RunTests
2022-05-18 16:10:12 +00:00
artifacts:
2022-05-20 20:06:24 +00:00
when: always
2022-05-18 16:10:12 +00:00
paths:
- install
2022-05-20 20:06:24 +00:00
- build/Testing/Temporary
2022-05-18 16:10:12 +00:00
{% macro packaging_job_name(distro, image) -%}
{{distro.name}}:{{image.codename}}:package
{%- endmacro %}
{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %}
{{packaging_job_name(distro, image)}}:
extends:
- {{base_job_to_use_image(distro, image)}}
- .monado.packaging.conditions
variables:
GIT_STRATEGY: clone
DEBFULLNAME: "{{packaging.name}}"
DEBEMAIL: "{{packaging.email}}"
DISTRO: {{distro.name}}
CODENAME: {{image.codename}}
DEB_VERSION_SUFFIX: {{image.deb_version_suffix}}
stage: package
before_script:
{# Configure git - needed despite not actually committing here. #}
- git config --global user.name {{packaging.name}}
- git config --global user.email {{packaging.email}}
script:
- .gitlab-ci/prebuild.sh
# Prep the source tree
- git clean -dfx
# Call this script to build binary and source packages.
# Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints.
- .gitlab-ci/build-and-submit-package.sh
artifacts:
paths:
- "incoming/"
expire_in: 2 days
{% endfor -%} {%- endfor %}
reprepro:package:
stage: reprepro
extends:
- {{ base_job_to_use_image_containing("reprepro") }}
- .monado.packaging.conditions
needs:
{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %}
- {{packaging_job_name(distro, image)}}
{% endfor -%} {%- endfor %}
script:
- bash .gitlab-ci/reprepro.sh
artifacts:
paths:
- "repo/"
expire_in: 2 days
###
# Pages
###
pages:
stage: pages
2023-04-15 00:19:20 +00:00
extends:
- .monado.packaging.conditions
needs:
- {{ documentation_build }}
- reprepro:package
script:
- mkdir -p public
- mv build/doc/html/* public/
- mv repo public/apt
artifacts:
paths:
- public