| 1 |
# SPDX-License-Identifier: CC0-1.0 |
| 2 |
# SPDX-FileCopyrightText: 2018-2024 Collabora, Ltd. and the Monado contributors |
| 3 |
|
| 4 |
{# ignore the warning, this is actually the template to edit. #} |
| 5 |
############################################### |
| 6 |
# GENERATED - DO NOT EDIT |
| 7 |
# see .gitlab-ci/ci.template, etc instead |
| 8 |
############################################### |
| 9 |
{# See README.md for instructions to regenerate after modification. #} |
| 10 |
{# |
| 11 |
useful links: |
| 12 |
https://freedesktop.pages.freedesktop.org/ci-templates/ |
| 13 |
https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml |
| 14 |
https://gitlab.freedesktop.org/freedesktop/ci-templates |
| 15 |
|
| 16 |
Config file used for all templates: .gitlab-ci/config.yml |
| 17 |
.gitlab-ci.yml template: .gitlab-ci/ci.template |
| 18 |
.gitlab-ci/distributions template (for reprepro): .gitlab-ci/distributions.jinja |
| 19 |
.gitlab-ci/reprepro.sh template: .gitlab-ci/reprepro.sh.jinja |
| 20 |
|
| 21 |
The following will update all files from templates: |
| 22 |
make -f .gitlab-ci/ci-scripts.mk |
| 23 |
#} |
| 24 |
|
| 25 |
# workflow: |
| 26 |
# rules: |
| 27 |
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event' |
| 28 |
# - if: $CI_PIPELINE_SOURCE == 'push' |
| 29 |
|
| 30 |
variables: |
| 31 |
FDO_UPSTREAM_REPO: "monado/monado" |
| 32 |
|
| 33 |
include: |
| 34 |
- project: "freedesktop/ci-templates" |
| 35 |
ref: {{fdo_ci_templates_sha}} |
| 36 |
file: |
| 37 |
{% for distro in distributions %} |
| 38 |
- "/templates/{{distro.name}}.yml" |
| 39 |
{% endfor %} |
| 40 |
# - local: .gitlab-ci/containers/ci-container-prep.yml |
| 41 |
|
| 42 |
# This include is for compatibility with the fdo CI restrictions/checks |
| 43 |
# needed due to https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438 |
| 44 |
- local: .gitlab-ci/ci-rules.yml |
| 45 |
|
| 46 |
stages: |
| 47 |
- container_prep |
| 48 |
- build |
| 49 |
- package |
| 50 |
- reprepro |
| 51 |
- pages |
| 52 |
- deploy |
| 53 |
|
| 54 |
### |
| 55 |
# Extra rules for packaging |
| 56 |
.monado.packaging.conditions: |
| 57 |
rules: |
| 58 |
# Only the default branch of the "upstream" repo on push. |
| 59 |
- if: $CI_PROJECT_PATH == $FDO_UPSTREAM_REPO && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" |
| 60 |
|
| 61 |
{% include 'include.win_containers.yml' %} |
| 62 |
{% include 'include.ci-containers-variables.yml.jinja' %} |
| 63 |
{% include 'include.ci-containers.yml.jinja' %} |
| 64 |
|
| 65 |
{% from 'include.functions.jinja' import image_name, base_job_to_use_image_containing, base_job_to_use_image with context %} |
| 66 |
|
| 67 |
# Style check job |
| 68 |
format-and-spellcheck: |
| 69 |
extends: |
| 70 |
- {{base_job_to_use_image_containing("codespell")}} |
| 71 |
stage: build |
| 72 |
script: |
| 73 |
- scripts/format-and-spellcheck.sh |
| 74 |
artifacts: |
| 75 |
paths: |
| 76 |
- patches/ |
| 77 |
expire_in: 1 week |
| 78 |
when: on_failure |
| 79 |
|
| 80 |
# Verify REUSE compliance |
| 81 |
reuse: |
| 82 |
extends: |
| 83 |
- .build-rules |
| 84 |
stage: build |
| 85 |
image: |
| 86 |
name: fsfe/reuse:latest |
| 87 |
entrypoint: [""] |
| 88 |
script: |
| 89 |
- reuse lint |
| 90 |
|
| 91 |
{% macro make_cmake_args(cmake_defines) %} |
| 92 |
{% if cmake_defines is defined and cmake_defines %} |
| 93 |
{%- for k, v in cmake_defines |dictsort %} -D{{ k }}={{ v }}{% endfor %} |
| 94 |
{%- endif %} |
| 95 |
{%- endmacro -%} |
| 96 |
|
| 97 |
{#### Main build jobs ####} |
| 98 |
{% for distro in distributions -%} {%- for image in distro.images if image.build_jobs -%} {%- for job in image.build_jobs %} |
| 99 |
|
| 100 |
{{job.name}}: |
| 101 |
stage: build |
| 102 |
extends: |
| 103 |
{% if job.name == documentation_build %} |
| 104 |
- .monado.packaging.conditions |
| 105 |
{% endif %} |
| 106 |
- {{base_job_to_use_image(distro, image)}} |
| 107 |
{% if job.extra_extends %} |
| 108 |
- {{ job.extra_extends }} |
| 109 |
{% endif %} |
| 110 |
|
| 111 |
{%- if job.before_script or "android" in job.name %} |
| 112 |
|
| 113 |
before_script: |
| 114 |
{% endif %} |
| 115 |
{% for line in job.before_script %} |
| 116 |
- {{line}} |
| 117 |
{% endfor %} |
| 118 |
{%- if "android" in job.name %} |
| 119 |
{# Keep this right below the before_script since this is an extra line!! #} |
| 120 |
# For caching gradle stuff |
| 121 |
- export GRADLE_USER_HOME=`pwd`/.gradlehome |
| 122 |
|
| 123 |
variables: |
| 124 |
GRADLE_ARGS: "-Porg.gradle.daemon=false " |
| 125 |
cache: |
| 126 |
paths: |
| 127 |
- .gradlehome/wrapper |
| 128 |
- .gradlehome/caches |
| 129 |
{% endif %} |
| 130 |
|
| 131 |
script: |
| 132 |
|
| 133 |
- .gitlab-ci/prebuild.sh |
| 134 |
{#- regular or NDK cmake builds -#} |
| 135 |
{%- if "cmake" in job.name or "ndk" in job.name %} |
| 136 |
|
| 137 |
- .gitlab-ci/ci-cmake-build.sh {{- make_cmake_args(job.cmake_defines) }} |
| 138 |
|
| 139 |
{#- gradle builds -#} |
| 140 |
{%- elif "android" in job.name %} |
| 141 |
|
| 142 |
{% if "Release" in job.name %} |
| 143 |
- base64 --decode ${MONADO_ANDROID_KEYSTORE} > monado-release.jks |
| 144 |
{% endif %} |
| 145 |
- .gitlab-ci/ci-gradle-build.sh {{ job.target }} |
| 146 |
|
| 147 |
{%- else %} |
| 148 |
|
| 149 |
{# error message #} |
| 150 |
CANNOT GUESS JOB TYPE |
| 151 |
|
| 152 |
{%- endif %} |
| 153 |
|
| 154 |
{%- if "cmake" in job.name %} |
| 155 |
|
| 156 |
- cd build && ctest --output-on-failure |
| 157 |
{%- endif %} |
| 158 |
|
| 159 |
{%- if job.artifact_path %} |
| 160 |
|
| 161 |
artifacts: |
| 162 |
paths: |
| 163 |
- {{ job.artifact_path }} |
| 164 |
{%- endif %} |
| 165 |
|
| 166 |
{% endfor -%} {%- endfor -%} {%- endfor %} |
| 167 |
|
| 168 |
# Windows build |
| 169 |
windows: |
| 170 |
stage: build |
| 171 |
extends: |
| 172 |
- .monado.image.windows |
| 173 |
script: |
| 174 |
- ./.gitlab-ci/windows/monado_build.ps1 -Install -RunTests |
| 175 |
artifacts: |
| 176 |
when: always |
| 177 |
paths: |
| 178 |
- install |
| 179 |
- build/Testing/Temporary |
| 180 |
|
| 181 |
{% macro packaging_job_name(distro, image) -%} |
| 182 |
{{ image_name(distro, image) }}:package |
| 183 |
{%- endmacro %} |
| 184 |
|
| 185 |
{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %} |
| 186 |
|
| 187 |
{{packaging_job_name(distro, image)}}: |
| 188 |
extends: |
| 189 |
- {{base_job_to_use_image(distro, image)}} |
| 190 |
- .monado.packaging.conditions |
| 191 |
variables: |
| 192 |
GIT_STRATEGY: clone |
| 193 |
DEBFULLNAME: "{{packaging.name}}" |
| 194 |
DEBEMAIL: "{{packaging.email}}" |
| 195 |
DISTRO: {{distro.name}} |
| 196 |
CODENAME: {{image.codename}} |
| 197 |
DEB_VERSION_SUFFIX: {{image.deb_version_suffix}} |
| 198 |
stage: package |
| 199 |
before_script: |
| 200 |
{# Configure git - needed despite not actually committing here. #} |
| 201 |
- git config --global user.name {{packaging.name}} |
| 202 |
- git config --global user.email {{packaging.email}} |
| 203 |
script: |
| 204 |
- .gitlab-ci/prebuild.sh |
| 205 |
# Prep the source tree |
| 206 |
- git clean -dfx |
| 207 |
# Call this script to build binary and source packages. |
| 208 |
# Can try locally by exporting the right variables and passing -B to get only a binary package to avoid complaints. |
| 209 |
- .gitlab-ci/build-and-submit-package.sh |
| 210 |
artifacts: |
| 211 |
paths: |
| 212 |
- "incoming/" |
| 213 |
expire_in: 2 days |
| 214 |
{% endfor -%} {%- endfor %} |
| 215 |
|
| 216 |
reprepro:package: |
| 217 |
stage: reprepro |
| 218 |
extends: |
| 219 |
- {{ base_job_to_use_image_containing("reprepro") }} |
| 220 |
- .monado.packaging.conditions |
| 221 |
needs: |
| 222 |
{% for distro in distributions -%} {%- for image in distro.images if "deb_version_suffix" in image %} |
| 223 |
- {{packaging_job_name(distro, image)}} |
| 224 |
{% endfor -%} {%- endfor %} |
| 225 |
script: |
| 226 |
- bash .gitlab-ci/reprepro.sh |
| 227 |
artifacts: |
| 228 |
paths: |
| 229 |
- "repo/" |
| 230 |
expire_in: 2 days |
| 231 |
|
| 232 |
### |
| 233 |
# Pages |
| 234 |
### |
| 235 |
pages: |
| 236 |
stage: pages |
| 237 |
extends: |
| 238 |
- .monado.packaging.conditions |
| 239 |
needs: |
| 240 |
- {{ documentation_build }} |
| 241 |
- reprepro:package |
| 242 |
script: |
| 243 |
- mkdir -p public |
| 244 |
- mv build/doc/html/* public/ |
| 245 |
- mv repo public/apt |
| 246 |
artifacts: |
| 247 |
paths: |
| 248 |
- public |