xref: /linux/drivers/gpu/drm/ci/gitlab-ci.yml (revision 6efced27f5df9d7a57e4847fe2898cdd19f72311)
1variables:
2  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
3  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha 25881c701a56233dd8fc7f92db6884a73949d63d
4
5  UPSTREAM_REPO: https://gitlab.freedesktop.org/drm/kernel.git
6  TARGET_BRANCH: drm-next
7
8  IGT_VERSION: 129d5b10baaadea1d6cd6377341c4cb42e7ee6fd
9
10  DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/mesa/deqp-runner.git
11  DEQP_RUNNER_GIT_TAG: v0.20.0
12
13  FDO_UPSTREAM_REPO: helen.fornazier/linux   # The repo where the git-archive daily runs
14  MESA_TEMPLATES_COMMIT: &ci-templates-commit aec7a6ce7bb38902c70641526f6611e27141784a
15  DRM_CI_PROJECT_URL: https://gitlab.freedesktop.org/${DRM_CI_PROJECT_PATH}
16  CI_PRE_CLONE_SCRIPT: |-
17          set -o xtrace
18          curl -L --retry 4 -f --retry-all-errors --retry-delay 60 -s ${DRM_CI_PROJECT_URL}/-/raw/${DRM_CI_COMMIT_SHA}/.gitlab-ci/download-git-cache.sh -o download-git-cache.sh
19          bash download-git-cache.sh
20          rm download-git-cache.sh
21          set +o xtrace
22  S3_JWT_FILE: /s3_jwt
23  S3_JWT_FILE_SCRIPT: |-
24      echo -n '${S3_JWT}' > '${S3_JWT_FILE}' &&
25      unset CI_JOB_JWT S3_JWT  # Unsetting vulnerable env variables
26  S3_HOST: s3.freedesktop.org
27  # This bucket is used to fetch the kernel image
28  S3_KERNEL_BUCKET: mesa-rootfs
29  # Bucket for git cache
30  S3_GITCACHE_BUCKET: git-cache
31  # Bucket for the pipeline artifacts pushed to S3
32  S3_ARTIFACTS_BUCKET: artifacts
33  # Base path used for various artifacts
34  S3_BASE_PATH: "${S3_HOST}/${S3_KERNEL_BUCKET}"
35  # per-pipeline artifact storage on MinIO
36  PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/${S3_ARTIFACTS_BUCKET}/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
37  # per-job artifact storage on MinIO
38  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
39  KERNEL_IMAGE_BASE: https://${S3_HOST}/${S3_KERNEL_BUCKET}/${KERNEL_REPO}/${KERNEL_TAG}
40  LAVA_TAGS: subset-1-gfx
41  # Default priority for non-merge pipelines
42  FDO_RUNNER_JOB_PRIORITY_TAG_X86_64: ""  # Empty tags are ignored by gitlab
43  FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM: kvm
44  FDO_RUNNER_JOB_PRIORITY_TAG_AARCH64: aarch64
45  JOB_PRIORITY: 30
46  ARTIFACTS_BASE_URL: https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts
47  # Python scripts for structured logger
48  PYTHONPATH: "$PYTHONPATH:$CI_PROJECT_DIR/install"
49  # Mesa-specific variables that shouldn't be forwarded to DUTs and crosvm
50  CI_EXCLUDE_ENV_VAR_REGEX: 'SCRIPTS_DIR|RESULTS_DIR'
51
52
53default:
54  id_tokens:
55    S3_JWT:
56      aud: https://s3.freedesktop.org
57  before_script:
58    - export SCRIPTS_DIR=$(mktemp -d)
59    - curl -L -s --retry 4 -f --retry-all-errors --retry-delay 60 -O --output-dir "${SCRIPTS_DIR}" "${DRM_CI_PROJECT_URL}/-/raw/${DRM_CI_COMMIT_SHA}/.gitlab-ci/setup-test-env.sh"
60    - source ${SCRIPTS_DIR}/setup-test-env.sh
61    - eval "$S3_JWT_FILE_SCRIPT"
62
63    - echo -e "\e[0Ksection_start:$(date +%s):drm_ci_download_section[collapsed=true]\r\e[0KDownloading mesa from $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz"
64    - cd $CI_PROJECT_DIR
65    - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
66    - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
67    - mv mesa-$DRM_CI_COMMIT_SHA/bin .
68    - rm -rf mesa-$DRM_CI_COMMIT_SHA/
69    - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
70
71  after_script:
72    - >
73      set +x
74
75      test -e "${S3_JWT_FILE}" &&
76      export S3_JWT="$(<${S3_JWT_FILE})" &&
77      rm "${S3_JWT_FILE}"
78
79
80include:
81  - project: 'freedesktop/ci-templates'
82    ref: *ci-templates-commit
83    file:
84      - '/templates/alpine.yml'
85      - '/templates/debian.yml'
86      - '/templates/fedora.yml'
87      - '/templates/ci-fairy.yml'
88  - project: *drm-ci-project-path
89    ref: *drm-ci-commit-sha
90    file:
91      - '/.gitlab-ci/bare-metal/gitlab-ci.yml'
92      - '/.gitlab-ci/build/gitlab-ci.yml'
93      - '/.gitlab-ci/container/gitlab-ci.yml'
94      - '/.gitlab-ci/farm-rules.yml'
95      - '/.gitlab-ci/lava/gitlab-ci.yml'
96      - '/.gitlab-ci/test-source-dep.yml'
97      - '/.gitlab-ci/test/gitlab-ci.yml'
98      - '/src/amd/ci/gitlab-ci-inc.yml'
99      - '/src/freedreno/ci/gitlab-ci-inc.yml'
100      - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
101      - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
102      - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
103      - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
104      - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
105      - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
106      - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
107      - '/src/gallium/frontends/rusticl/ci/gitlab-ci.yml'
108      - '/src/intel/ci/gitlab-ci-inc.yml'
109      - '/src/microsoft/ci/gitlab-ci-inc.yml'
110      - '/src/nouveau/ci/gitlab-ci-inc.yml'
111      - '/src/virtio/ci/gitlab-ci-inc.yml'
112      - 'docs/gitlab-ci.yml'
113  - drivers/gpu/drm/ci/image-tags.yml
114  - drivers/gpu/drm/ci/container.yml
115  - drivers/gpu/drm/ci/static-checks.yml
116  - drivers/gpu/drm/ci/build.yml
117  - drivers/gpu/drm/ci/test.yml
118  - drivers/gpu/drm/ci/check-devicetrees.yml
119  - drivers/gpu/drm/ci/kunit.yml
120  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
121
122
123stages:
124  - sanity
125  - container
126  - deploy
127  - git-archive
128  - build-for-tests
129  - build-only
130  - static-checks
131  - kunit
132  - code-validation
133  - amdgpu
134  - i915
135  - mediatek
136  - meson
137  - msm
138  - panfrost
139  - panthor
140  - powervr
141  - rockchip
142  - software-driver
143
144
145# YAML anchors for rule conditions
146# --------------------------------
147.rules-anchors:
148  rules:
149    # do not duplicate pipelines on merge pipelines
150    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
151      when: never
152    # merge pipeline
153    - if: &is-merge-attempt $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"
154    # post-merge pipeline
155    - if: &is-post-merge $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "push"
156    # Pre-merge pipeline (because merge pipelines are already caught above)
157    - if: &is-merge-request $CI_PIPELINE_SOURCE == "merge_request_event"
158    # Push to a branch on a fork
159    - if: &is-push-to-fork $CI_PIPELINE_SOURCE == "push"
160    # nightly pipeline
161    - if: &is-scheduled-pipeline $CI_PIPELINE_SOURCE == "schedule"
162    # pipeline for direct pushes that bypassed the CI
163    - if: &is-direct-push $CI_PIPELINE_SOURCE == "push" && $GITLAB_USER_LOGIN != "marge-bot"
164
165
166# Rules applied to every job in the pipeline
167.common-rules:
168  rules:
169    - if: *is-push-to-fork
170      when: manual
171
172.never-post-merge-rules:
173  rules:
174    - if: *is-post-merge
175      when: never
176
177
178# Note: make sure the branches in this list are the same as in
179# `.build-only-delayed-rules` below.
180.container-rules:
181  rules:
182    - !reference [.common-rules, rules]
183    # Run when re-enabling a disabled farm, but not when disabling it
184    - !reference [.disable-farm-mr-rules, rules]
185    # Never run immediately after merging, as we just ran everything
186    - !reference [.never-post-merge-rules, rules]
187    # Only rebuild containers in merge pipelines if any tags have been
188    # changed, else we'll just use the already-built containers
189    - if: *is-merge-attempt
190      changes: &image_tags_path
191        - drivers/gpu/drm/ci/image-tags.yml
192      when: on_success
193    # Skip everything for pre-merge and merge pipelines which don't change
194    # anything in the build; we only do this for marge-bot and not user
195    # pipelines in a MR, because we might still need to run it to copy the
196    # container into the user's namespace.
197    - if: *is-merge-attempt
198      when: never
199    # Any MR pipeline which changes image-tags.yml needs to be able to
200    # rebuild the containers
201    - if: *is-merge-request
202      changes: *image_tags_path
203      when: manual
204    # ... however for MRs running inside the user namespace, we may need to
205    # run these jobs to copy the container images from upstream
206    - if: *is-merge-request
207      when: manual
208    # Build everything after someone bypassed the CI
209    - if: *is-direct-push
210      when: manual
211    # Scheduled pipelines reuse already-built containers
212    - if: *is-scheduled-pipeline
213      when: never
214    # Allow building everything in fork pipelines, but build nothing unless
215    # manually triggered
216    - when: manual
217
218
219# Note: make sure the branches in this list are the same as in
220# `.build-only-delayed-rules` below.
221.build-rules:
222  rules:
223    - !reference [.common-rules, rules]
224    # Run when re-enabling a disabled farm, but not when disabling it
225    - !reference [.disable-farm-mr-rules, rules]
226    # Never run immediately after merging, as we just ran everything
227    - !reference [.never-post-merge-rules, rules]
228    # Build everything in merge pipelines
229    - if: *is-merge-attempt
230      when: on_success
231    # Same as above, but for pre-merge pipelines
232    - if: *is-merge-request
233      when: manual
234    # Build everything after someone bypassed the CI
235    - if: *is-direct-push
236      when: manual
237    # Build everything in scheduled pipelines
238    - if: *is-scheduled-pipeline
239      when: on_success
240    # Allow building everything in fork pipelines, but build nothing unless
241    # manually triggered
242    - when: manual
243
244
245# Repeat of the above but with `when: on_success` replaced with
246# `when: delayed` + `start_in:`, for build-only jobs.
247# Note: make sure the branches in this list are the same as in
248# `.build-rules` above.
249.build-only-delayed-rules:
250  rules:
251    - !reference [.common-rules, rules]
252    # Run when re-enabling a disabled farm, but not when disabling it
253    - !reference [.disable-farm-mr-rules, rules]
254    # Never run immediately after merging, as we just ran everything
255    - !reference [.never-post-merge-rules, rules]
256    # Build everything in merge pipelines
257    - if: *is-merge-attempt
258      when: delayed
259      start_in: &build-delay 5 minutes
260    # Same as above, but for pre-merge pipelines
261    - if: *is-merge-request
262      when: manual
263    # Build everything after someone bypassed the CI
264    - if: *is-direct-push
265      when: manual
266    # Build everything in scheduled pipelines
267    - if: *is-scheduled-pipeline
268      when: delayed
269      start_in: *build-delay
270    # Allow building everything in fork pipelines, but build nothing unless
271    # manually triggered
272    - when: manual
273
274
275.ci-deqp-artifacts:
276  artifacts:
277    name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}"
278    when: always
279    untracked: false
280    paths:
281      # Watch out!  Artifacts are relative to the build dir.
282      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
283      - artifacts
284      - _build/meson-logs/*.txt
285      - _build/meson-logs/strace
286
287
288# Git archive
289make-git-archive:
290  extends:
291    - .fdo.ci-fairy
292  stage: git-archive
293  rules:
294    - !reference [.scheduled_pipeline-rules, rules]
295  tags:
296    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
297  script:
298    # Remove drm-ci files we just added
299    - rm -rf .gitlab-ci.*
300    - rm -rf ci
301
302    # Compactify the .git directory
303    - git gc --aggressive
304    # compress the current folder
305    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
306
307    # Use id_tokens for JWT auth
308    - ci-fairy s3cp --token-file "${S3_JWT_FILE}" ../$CI_PROJECT_NAME.tar.gz https://$S3_HOST/${S3_GITCACHE_BUCKET}/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_PROJECT_NAME.tar.gz
309
310
311# Sanity checks of MR settings and commit logs
312sanity:
313  extends:
314    - .fdo.ci-fairy
315  stage: sanity
316  tags:
317    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
318  rules:
319    - if: *is-merge-request
320      when: on_success
321    - when: never
322  variables:
323    GIT_STRATEGY: none
324  script:
325    # ci-fairy check-commits --junit-xml=check-commits.xml
326    # - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
327    - |
328      set -eu
329      image_tags=(
330        CONTAINER_TAG
331        DEBIAN_BASE_TAG
332        DEBIAN_BUILD_TAG
333        DEBIAN_PYUTILS_TAG
334        DEBIAN_TEST_GL_TAG
335        KERNEL_TAG
336        PKG_REPO_REV
337      )
338      for var in "${image_tags[@]}"
339      do
340        if [ "$(echo -n "${!var}" | wc -c)" -gt 20 ]
341        then
342          echo "$var is too long; please make sure it is at most 20 chars."
343          exit 1
344        fi
345      done
346  artifacts:
347    when: on_failure
348    reports:
349      junit: check-*.xml
350
351
352mr-label-maker-test:
353  extends:
354    - .fdo.ci-fairy
355  stage: sanity
356  tags:
357    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
358  rules:
359    - !reference [.mr-label-maker-rules, rules]
360  variables:
361    GIT_STRATEGY: fetch
362  timeout: 10m
363  script:
364    - set -eu
365    - python3 -m venv .venv
366    - source .venv/bin/activate
367    - pip install git+https://gitlab.freedesktop.org/freedesktop/mr-label-maker
368    - mr-label-maker --dry-run --mr $CI_MERGE_REQUEST_IID
369
370
371# Jobs that need to pass before spending hardware resources on further testing
372.required-for-hardware-jobs:
373  needs:
374    - job: clang-format
375      optional: true
376    - job: rustfmt
377      optional: true
378    - job: toml-lint
379      optional: true
380
381deploy-docs:
382   rules:
383    - when: never
384
385linkcheck-docs:
386   rules:
387    - when: never
388
389test-docs:
390   rules:
391    - when: never
392
393.ci-tron-x86_64-test-vk:
394   rules:
395    - when: never
396
397.ci-tron-x86_64-test-gl-manual:
398   rules:
399    - when: never
400
401.ci-tron-arm64-test-gl:
402   rules:
403    - when: never
404
405.ci-tron-x86_64-test-gl:
406   rules:
407    - when: never
408