1bf215546Sopenharmony_civariables:
2bf215546Sopenharmony_ci  FDO_UPSTREAM_REPO: mesa/mesa
3bf215546Sopenharmony_ci  MESA_TEMPLATES_COMMIT: &ci-templates-commit 290b79e0e78eab67a83766f4e9691be554fc4afd
4bf215546Sopenharmony_ci  CI_PRE_CLONE_SCRIPT: |-
5bf215546Sopenharmony_ci          set -o xtrace
6bf215546Sopenharmony_ci          wget -q -O download-git-cache.sh ${CI_PROJECT_URL}/-/raw/${CI_COMMIT_SHA}/.gitlab-ci/download-git-cache.sh
7bf215546Sopenharmony_ci          bash download-git-cache.sh
8bf215546Sopenharmony_ci          rm download-git-cache.sh
9bf215546Sopenharmony_ci          set +o xtrace
10bf215546Sopenharmony_ci  CI_JOB_JWT_FILE: /minio_jwt
11bf215546Sopenharmony_ci  MINIO_HOST: s3.freedesktop.org
12bf215546Sopenharmony_ci  # per-pipeline artifact storage on MinIO
13bf215546Sopenharmony_ci  PIPELINE_ARTIFACTS_BASE: ${MINIO_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
14bf215546Sopenharmony_ci  # per-job artifact storage on MinIO
15bf215546Sopenharmony_ci  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
16bf215546Sopenharmony_ci  # reference images stored for traces
17bf215546Sopenharmony_ci  PIGLIT_REPLAY_REFERENCE_IMAGES_BASE: "${MINIO_HOST}/mesa-tracie-results/$FDO_UPSTREAM_REPO"
18bf215546Sopenharmony_ci  # Individual CI farm status, set to "offline" to disable jobs
19bf215546Sopenharmony_ci  # running on a particular CI farm (ie. for outages, etc):
20bf215546Sopenharmony_ci  FD_FARM: "online"
21bf215546Sopenharmony_ci  COLLABORA_FARM: "online"
22bf215546Sopenharmony_ci  MICROSOFT_FARM: "online"
23bf215546Sopenharmony_ci  LIMA_FARM: "online"
24bf215546Sopenharmony_ci  IGALIA_FARM: "online"
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_cidefault:
27bf215546Sopenharmony_ci  before_script:
28bf215546Sopenharmony_ci    - echo -e "\e[0Ksection_start:$(date +%s):unset_env_vars_section[collapsed=true]\r\e[0KUnsetting vulnerable environment variables"
29bf215546Sopenharmony_ci    - echo -n "${CI_JOB_JWT}" > "${CI_JOB_JWT_FILE}"
30bf215546Sopenharmony_ci    - unset CI_JOB_JWT
31bf215546Sopenharmony_ci    - echo -e "\e[0Ksection_end:$(date +%s):unset_env_vars_section\r\e[0K"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci  after_script:
34bf215546Sopenharmony_ci    - >
35bf215546Sopenharmony_ci      set +x
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci      test -e "${CI_JOB_JWT_FILE}" &&
38bf215546Sopenharmony_ci      export CI_JOB_JWT="$(<${CI_JOB_JWT_FILE})" &&
39bf215546Sopenharmony_ci      rm "${CI_JOB_JWT_FILE}"
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_ci  # Retry build or test jobs up to twice when the gitlab-runner itself fails somehow.
42bf215546Sopenharmony_ci  retry:
43bf215546Sopenharmony_ci    max: 2
44bf215546Sopenharmony_ci    when:
45bf215546Sopenharmony_ci      - runner_system_failure
46bf215546Sopenharmony_ci
47bf215546Sopenharmony_ciinclude:
48bf215546Sopenharmony_ci  - project: 'freedesktop/ci-templates'
49bf215546Sopenharmony_ci    ref: ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2
50bf215546Sopenharmony_ci    file:
51bf215546Sopenharmony_ci      - '/templates/ci-fairy.yml'
52bf215546Sopenharmony_ci  - project: 'freedesktop/ci-templates'
53bf215546Sopenharmony_ci    ref: *ci-templates-commit
54bf215546Sopenharmony_ci    file:
55bf215546Sopenharmony_ci      - '/templates/debian.yml'
56bf215546Sopenharmony_ci      - '/templates/fedora.yml'
57bf215546Sopenharmony_ci  - local: '.gitlab-ci/image-tags.yml'
58bf215546Sopenharmony_ci  - local: '.gitlab-ci/lava/lava-gitlab-ci.yml'
59bf215546Sopenharmony_ci  - local: '.gitlab-ci/container/gitlab-ci.yml'
60bf215546Sopenharmony_ci  - local: '.gitlab-ci/build/gitlab-ci.yml'
61bf215546Sopenharmony_ci  - local: '.gitlab-ci/test/gitlab-ci.yml'
62bf215546Sopenharmony_ci  - local: '.gitlab-ci/test-source-dep.yml'
63bf215546Sopenharmony_ci  - local: 'src/amd/ci/gitlab-ci.yml'
64bf215546Sopenharmony_ci  - local: 'src/broadcom/ci/gitlab-ci.yml'
65bf215546Sopenharmony_ci  - local: 'src/etnaviv/ci/gitlab-ci.yml'
66bf215546Sopenharmony_ci  - local: 'src/freedreno/ci/gitlab-ci.yml'
67bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/crocus/ci/gitlab-ci.yml'
68bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/d3d12/ci/gitlab-ci.yml'
69bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/i915/ci/gitlab-ci.yml'
70bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/lima/ci/gitlab-ci.yml'
71bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/llvmpipe/ci/gitlab-ci.yml'
72bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/nouveau/ci/gitlab-ci.yml'
73bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/radeonsi/ci/gitlab-ci.yml'
74bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/softpipe/ci/gitlab-ci.yml'
75bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/virgl/ci/gitlab-ci.yml'
76bf215546Sopenharmony_ci  - local: 'src/gallium/drivers/zink/ci/gitlab-ci.yml'
77bf215546Sopenharmony_ci  - local: 'src/gallium/frontends/lavapipe/ci/gitlab-ci.yml'
78bf215546Sopenharmony_ci  - local: 'src/intel/ci/gitlab-ci.yml'
79bf215546Sopenharmony_ci  - local: 'src/microsoft/ci/gitlab-ci.yml'
80bf215546Sopenharmony_ci  - local: 'src/panfrost/ci/gitlab-ci.yml'
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_cistages:
83bf215546Sopenharmony_ci  - sanity
84bf215546Sopenharmony_ci  - container
85bf215546Sopenharmony_ci  - git-archive
86bf215546Sopenharmony_ci  - build-x86_64
87bf215546Sopenharmony_ci  - build-misc
88bf215546Sopenharmony_ci  - amd
89bf215546Sopenharmony_ci  - intel
90bf215546Sopenharmony_ci  - nouveau
91bf215546Sopenharmony_ci  - arm
92bf215546Sopenharmony_ci  - broadcom
93bf215546Sopenharmony_ci  - freedreno
94bf215546Sopenharmony_ci  - etnaviv
95bf215546Sopenharmony_ci  - software-renderer
96bf215546Sopenharmony_ci  - layered-backends
97bf215546Sopenharmony_ci  - deploy
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ci
100bf215546Sopenharmony_ci# YAML anchors for rule conditions
101bf215546Sopenharmony_ci# --------------------------------
102bf215546Sopenharmony_ci.rules-anchors:
103bf215546Sopenharmony_ci  rules:
104bf215546Sopenharmony_ci    # Pipeline for forked project branch
105bf215546Sopenharmony_ci    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
106bf215546Sopenharmony_ci      when: manual
107bf215546Sopenharmony_ci    # Forked project branch / pre-merge pipeline not for Marge bot
108bf215546Sopenharmony_ci    - if: &is-forked-branch-or-pre-merge-not-for-marge '$CI_PROJECT_NAMESPACE != "mesa" || ($GITLAB_USER_LOGIN != "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event")'
109bf215546Sopenharmony_ci      when: manual
110bf215546Sopenharmony_ci    # Pipeline runs for the main branch of the upstream Mesa project
111bf215546Sopenharmony_ci    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
112bf215546Sopenharmony_ci      when: always
113bf215546Sopenharmony_ci    # Post-merge pipeline
114bf215546Sopenharmony_ci    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
115bf215546Sopenharmony_ci      when: on_success
116bf215546Sopenharmony_ci    # Post-merge pipeline, not for Marge Bot
117bf215546Sopenharmony_ci    - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
118bf215546Sopenharmony_ci      when: on_success
119bf215546Sopenharmony_ci    # Pre-merge pipeline
120bf215546Sopenharmony_ci    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
121bf215546Sopenharmony_ci      when: on_success
122bf215546Sopenharmony_ci    # Pre-merge pipeline for Marge Bot
123bf215546Sopenharmony_ci    - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
124bf215546Sopenharmony_ci      when: on_success
125bf215546Sopenharmony_ci
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_ci.docs-base:
128bf215546Sopenharmony_ci  extends:
129bf215546Sopenharmony_ci    - .fdo.ci-fairy
130bf215546Sopenharmony_ci    - .build-rules
131bf215546Sopenharmony_ci  script:
132bf215546Sopenharmony_ci  - apk --no-cache add graphviz doxygen
133bf215546Sopenharmony_ci  - pip3 install sphinx===5.1.1 breathe===4.34.0 mako===1.2.3 sphinx_rtd_theme===1.0.0
134bf215546Sopenharmony_ci  - docs/doxygen-wrapper.py --out-dir=docs/doxygen_xml
135bf215546Sopenharmony_ci  - sphinx-build -W -b html docs public
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_cipages:
138bf215546Sopenharmony_ci  extends: .docs-base
139bf215546Sopenharmony_ci  stage: deploy
140bf215546Sopenharmony_ci  artifacts:
141bf215546Sopenharmony_ci    paths:
142bf215546Sopenharmony_ci    - public
143bf215546Sopenharmony_ci  needs: []
144bf215546Sopenharmony_ci  rules:
145bf215546Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
146bf215546Sopenharmony_ci    - if: *is-mesa-main
147bf215546Sopenharmony_ci      changes: &docs-or-ci
148bf215546Sopenharmony_ci      - docs/**/*
149bf215546Sopenharmony_ci      - .gitlab-ci.yml
150bf215546Sopenharmony_ci      when: always
151bf215546Sopenharmony_ci    # Other cases default to never
152bf215546Sopenharmony_ci
153bf215546Sopenharmony_citest-docs:
154bf215546Sopenharmony_ci  extends: .docs-base
155bf215546Sopenharmony_ci  # Cancel job if a newer commit is pushed to the same branch
156bf215546Sopenharmony_ci  interruptible: true
157bf215546Sopenharmony_ci  stage: deploy
158bf215546Sopenharmony_ci  needs: []
159bf215546Sopenharmony_ci  rules:
160bf215546Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
161bf215546Sopenharmony_ci    - if: *is-forked-branch
162bf215546Sopenharmony_ci      changes: *docs-or-ci
163bf215546Sopenharmony_ci      when: manual
164bf215546Sopenharmony_ci    # Other cases default to never
165bf215546Sopenharmony_ci
166bf215546Sopenharmony_citest-docs-mr:
167bf215546Sopenharmony_ci  extends:
168bf215546Sopenharmony_ci    - test-docs
169bf215546Sopenharmony_ci  needs:
170bf215546Sopenharmony_ci    - sanity
171bf215546Sopenharmony_ci  artifacts:
172bf215546Sopenharmony_ci    expose_as: 'Documentation preview'
173bf215546Sopenharmony_ci    paths:
174bf215546Sopenharmony_ci    - public/
175bf215546Sopenharmony_ci  rules:
176bf215546Sopenharmony_ci    - if: *is-pre-merge
177bf215546Sopenharmony_ci      changes: *docs-or-ci
178bf215546Sopenharmony_ci      when: on_success
179bf215546Sopenharmony_ci    # Other cases default to never
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci# When to automatically run the CI for build jobs
182bf215546Sopenharmony_ci.build-rules:
183bf215546Sopenharmony_ci  rules:
184bf215546Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
185bf215546Sopenharmony_ci    # If any files affecting the pipeline are changed, build/test jobs run
186bf215546Sopenharmony_ci    # automatically once all dependency jobs have passed
187bf215546Sopenharmony_ci    - changes: &all_paths
188bf215546Sopenharmony_ci      - VERSION
189bf215546Sopenharmony_ci      - bin/git_sha1_gen.py
190bf215546Sopenharmony_ci      - bin/install_megadrivers.py
191bf215546Sopenharmony_ci      - bin/meson_get_version.py
192bf215546Sopenharmony_ci      - bin/symbols-check.py
193bf215546Sopenharmony_ci      # GitLab CI
194bf215546Sopenharmony_ci      - .gitlab-ci.yml
195bf215546Sopenharmony_ci      - .gitlab-ci/**/*
196bf215546Sopenharmony_ci      # Meson
197bf215546Sopenharmony_ci      - meson*
198bf215546Sopenharmony_ci      - build-support/**/*
199bf215546Sopenharmony_ci      - subprojects/**/*
200bf215546Sopenharmony_ci      # Source code
201bf215546Sopenharmony_ci      - include/**/*
202bf215546Sopenharmony_ci      - src/**/*
203bf215546Sopenharmony_ci      when: on_success
204bf215546Sopenharmony_ci    # Otherwise, build/test jobs won't run because no rule matched.
205bf215546Sopenharmony_ci
206bf215546Sopenharmony_ci
207bf215546Sopenharmony_ci.ci-deqp-artifacts:
208bf215546Sopenharmony_ci  artifacts:
209bf215546Sopenharmony_ci    name: "mesa_${CI_JOB_NAME}"
210bf215546Sopenharmony_ci    when: always
211bf215546Sopenharmony_ci    untracked: false
212bf215546Sopenharmony_ci    paths:
213bf215546Sopenharmony_ci      # Watch out!  Artifacts are relative to the build dir.
214bf215546Sopenharmony_ci      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
215bf215546Sopenharmony_ci      - artifacts
216bf215546Sopenharmony_ci      - _build/meson-logs/*.txt
217bf215546Sopenharmony_ci      - _build/meson-logs/strace
218bf215546Sopenharmony_ci
219bf215546Sopenharmony_ci.container-rules:
220bf215546Sopenharmony_ci  rules:
221bf215546Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
222bf215546Sopenharmony_ci    # Run pipeline by default in the main project if any CI pipeline
223bf215546Sopenharmony_ci    # configuration files were changed, to ensure docker images are up to date
224bf215546Sopenharmony_ci    - if: *is-post-merge
225bf215546Sopenharmony_ci      changes:
226bf215546Sopenharmony_ci      - .gitlab-ci.yml
227bf215546Sopenharmony_ci      - .gitlab-ci/**/*
228bf215546Sopenharmony_ci      when: on_success
229bf215546Sopenharmony_ci    # Run pipeline by default if it was triggered by Marge Bot, is for a
230bf215546Sopenharmony_ci    # merge request, and any files affecting the pipeline were changed
231bf215546Sopenharmony_ci    - if: *is-pre-merge-for-marge
232bf215546Sopenharmony_ci      changes:
233bf215546Sopenharmony_ci        *all_paths
234bf215546Sopenharmony_ci      when: on_success
235bf215546Sopenharmony_ci    # Run pipeline by default in the main project if it was not triggered by
236bf215546Sopenharmony_ci    # Marge Bot, and any files affecting the pipeline were changed
237bf215546Sopenharmony_ci    - if: *is-post-merge-not-for-marge
238bf215546Sopenharmony_ci      changes:
239bf215546Sopenharmony_ci        *all_paths
240bf215546Sopenharmony_ci      when: on_success
241bf215546Sopenharmony_ci    # Allow triggering jobs manually in other cases if any files affecting the
242bf215546Sopenharmony_ci    # pipeline were changed
243bf215546Sopenharmony_ci    - changes:
244bf215546Sopenharmony_ci        *all_paths
245bf215546Sopenharmony_ci      when: manual
246bf215546Sopenharmony_ci    # Otherwise, container jobs won't run because no rule matched.
247bf215546Sopenharmony_ci
248bf215546Sopenharmony_ci# Git archive
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_cimake git archive:
251bf215546Sopenharmony_ci  extends:
252bf215546Sopenharmony_ci    - .fdo.ci-fairy
253bf215546Sopenharmony_ci  stage: git-archive
254bf215546Sopenharmony_ci  rules:
255bf215546Sopenharmony_ci    - !reference [.scheduled_pipeline-rules, rules]
256bf215546Sopenharmony_ci  # ensure we are running on packet
257bf215546Sopenharmony_ci  tags:
258bf215546Sopenharmony_ci    - packet.net
259bf215546Sopenharmony_ci  script:
260bf215546Sopenharmony_ci    # Compactify the .git directory
261bf215546Sopenharmony_ci    - git gc --aggressive
262bf215546Sopenharmony_ci    # compress the current folder
263bf215546Sopenharmony_ci    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
264bf215546Sopenharmony_ci
265bf215546Sopenharmony_ci    - ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ../$CI_PROJECT_NAME.tar.gz https://$MINIO_HOST/git-cache/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_PROJECT_NAME.tar.gz
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci# Sanity checks of MR settings and commit logs
269bf215546Sopenharmony_cisanity:
270bf215546Sopenharmony_ci  extends:
271bf215546Sopenharmony_ci    - .fdo.ci-fairy
272bf215546Sopenharmony_ci  stage: sanity
273bf215546Sopenharmony_ci  rules:
274bf215546Sopenharmony_ci    - if: *is-pre-merge
275bf215546Sopenharmony_ci      when: on_success
276bf215546Sopenharmony_ci    # Other cases default to never
277bf215546Sopenharmony_ci  variables:
278bf215546Sopenharmony_ci    GIT_STRATEGY: none
279bf215546Sopenharmony_ci  script:
280bf215546Sopenharmony_ci    # ci-fairy check-commits --junit-xml=check-commits.xml
281bf215546Sopenharmony_ci    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
282bf215546Sopenharmony_ci  artifacts:
283bf215546Sopenharmony_ci    when: on_failure
284bf215546Sopenharmony_ci    reports:
285bf215546Sopenharmony_ci      junit: check-*.xml
286bf215546Sopenharmony_ci
287bf215546Sopenharmony_ci# Rules for tests that should not block merging, but should be available to
288bf215546Sopenharmony_ci# optionally run with the "play" button in the UI in pre-merge non-marge
289bf215546Sopenharmony_ci# pipelines.  This should appear in "extends:" after any includes of
290bf215546Sopenharmony_ci# test-source-dep.yml rules, so that these rules replace those.
291bf215546Sopenharmony_ci.test-manual-mr:
292bf215546Sopenharmony_ci  rules:
293bf215546Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
294bf215546Sopenharmony_ci    - if: *is-forked-branch-or-pre-merge-not-for-marge
295bf215546Sopenharmony_ci      changes:
296bf215546Sopenharmony_ci        *all_paths
297bf215546Sopenharmony_ci      when: manual
298bf215546Sopenharmony_ci  variables:
299bf215546Sopenharmony_ci    JOB_TIMEOUT: 80
300bf215546Sopenharmony_ci
301