xref: /linux/drivers/gpu/drm/ci/gitlab-ci.yml (revision ab93e0dd72c37d378dd936f031ffb83ff2bd87ce)
1variables:
2  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
3  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha 02337aec715c25dae7ff2479d986f831c77fe536
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 c6aeb16f86e32525fa630fb99c66c4f3e62fc3cb
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  # per-pipeline artifact storage on MinIO
34  PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/${S3_ARTIFACTS_BUCKET}/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
35  # per-job artifact storage on MinIO
36  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
37  KERNEL_IMAGE_BASE: https://${S3_HOST}/${S3_KERNEL_BUCKET}/${KERNEL_REPO}/${KERNEL_TAG}
38  LAVA_TAGS: subset-1-gfx
39  # Default priority for non-merge pipelines
40  FDO_RUNNER_JOB_PRIORITY_TAG_X86_64: ""  # Empty tags are ignored by gitlab
41  FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM: kvm
42  FDO_RUNNER_JOB_PRIORITY_TAG_AARCH64: aarch64
43  JOB_PRIORITY: 30
44  ARTIFACTS_BASE_URL: https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts
45  # Python scripts for structured logger
46  PYTHONPATH: "$PYTHONPATH:$CI_PROJECT_DIR/install"
47
48
49default:
50  id_tokens:
51    S3_JWT:
52      aud: https://s3.freedesktop.org
53  before_script:
54    - export SCRIPTS_DIR=$(mktemp -d)
55    - 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"
56    - source ${SCRIPTS_DIR}/setup-test-env.sh
57    - eval "$S3_JWT_FILE_SCRIPT"
58
59    - 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"
60    - cd $CI_PROJECT_DIR
61    - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
62    - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
63    - mv mesa-$DRM_CI_COMMIT_SHA/bin .
64    - rm -rf mesa-$DRM_CI_COMMIT_SHA/
65    - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
66
67  after_script:
68    - >
69      set +x
70
71      test -e "${S3_JWT_FILE}" &&
72      export S3_JWT="$(<${S3_JWT_FILE})" &&
73      rm "${S3_JWT_FILE}"
74
75
76include:
77  - project: 'freedesktop/ci-templates'
78    ref: *ci-templates-commit
79    file:
80      - '/templates/alpine.yml'
81      - '/templates/debian.yml'
82      - '/templates/fedora.yml'
83      - '/templates/ci-fairy.yml'
84  - project: *drm-ci-project-path
85    ref: *drm-ci-commit-sha
86    file:
87      - '/.gitlab-ci/build/gitlab-ci.yml'
88      - '/.gitlab-ci/container/gitlab-ci.yml'
89      - '/.gitlab-ci/farm-rules.yml'
90      - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
91      - '/.gitlab-ci/test-source-dep.yml'
92      - '/.gitlab-ci/test/gitlab-ci.yml'
93      - '/src/amd/ci/gitlab-ci-inc.yml'
94      - '/src/freedreno/ci/gitlab-ci-inc.yml'
95      - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
96      - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
97      - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
98      - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
99      - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
100      - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
101      - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
102      - '/src/gallium/frontends/rusticl/ci/gitlab-ci.yml'
103      - '/src/intel/ci/gitlab-ci-inc.yml'
104      - '/src/microsoft/ci/gitlab-ci-inc.yml'
105      - '/src/nouveau/ci/gitlab-ci-inc.yml'
106      - '/src/virtio/ci/gitlab-ci-inc.yml'
107      - 'docs/gitlab-ci.yml'
108  - drivers/gpu/drm/ci/image-tags.yml
109  - drivers/gpu/drm/ci/container.yml
110  - drivers/gpu/drm/ci/static-checks.yml
111  - drivers/gpu/drm/ci/build.yml
112  - drivers/gpu/drm/ci/test.yml
113  - drivers/gpu/drm/ci/check-devicetrees.yml
114  - drivers/gpu/drm/ci/kunit.yml
115  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
116
117
118stages:
119  - sanity
120  - container
121  - deploy
122  - git-archive
123  - build-for-tests
124  - build-only
125  - static-checks
126  - kunit
127  - code-validation
128  - amdgpu
129  - i915
130  - mediatek
131  - meson
132  - msm
133  - panfrost
134  - powervr
135  - rockchip
136  - software-driver
137
138
139# YAML anchors for rule conditions
140# --------------------------------
141.rules-anchors:
142  rules:
143    # do not duplicate pipelines on merge pipelines
144    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
145      when: never
146    # merge pipeline
147    - if: &is-merge-attempt $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"
148    # post-merge pipeline
149    - if: &is-post-merge $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "push"
150    # Pre-merge pipeline
151    - if: &is-pre-merge $CI_PIPELINE_SOURCE == "merge_request_event"
152    # Push to a branch on a fork
153    - if: &is-fork-push $CI_PIPELINE_SOURCE == "push"
154    # nightly pipeline
155    - if: &is-scheduled-pipeline $CI_PIPELINE_SOURCE == "schedule"
156    # pipeline for direct pushes that bypassed the CI
157    - if: &is-direct-push $CI_PIPELINE_SOURCE == "push" && $GITLAB_USER_LOGIN != "marge-bot"
158
159
160# Rules applied to every job in the pipeline
161.common-rules:
162  rules:
163    - if: *is-fork-push
164      when: manual
165
166
167.never-post-merge-rules:
168  rules:
169    - if: *is-post-merge
170      when: never
171
172
173.container+build-rules:
174  rules:
175    - !reference [.common-rules, rules]
176    # Run when re-enabling a disabled farm, but not when disabling it
177    - !reference [.disable-farm-mr-rules, rules]
178    # Never run immediately after merging, as we just ran everything
179    - !reference [.never-post-merge-rules, rules]
180    # Build everything in merge pipelines
181    - if: *is-merge-attempt
182      when: on_success
183    # Same as above, but for pre-merge pipelines
184    - if: *is-pre-merge
185      when: manual
186    # Build everything after someone bypassed the CI
187    - if: *is-direct-push
188      when: manual
189    # Build everything in scheduled pipelines
190    - if: *is-scheduled-pipeline
191      when: on_success
192    # Allow building everything in fork pipelines, but build nothing unless
193    # manually triggered
194    - when: manual
195
196
197# Repeat of the above but with `when: on_success` replaced with
198# `when: delayed` + `start_in:`, for build-only jobs.
199# Note: make sure the branches in this list are the same as in
200# `.container+build-rules` above.
201.build-only-delayed-rules:
202  rules:
203    - !reference [.common-rules, rules]
204    # Run when re-enabling a disabled farm, but not when disabling it
205    - !reference [.disable-farm-mr-rules, rules]
206    # Never run immediately after merging, as we just ran everything
207    - !reference [.never-post-merge-rules, rules]
208    # Build everything in merge pipelines
209    - if: *is-merge-attempt
210      when: delayed
211      start_in: &build-delay 5 minutes
212    # Same as above, but for pre-merge pipelines
213    - if: *is-pre-merge
214      when: manual
215    # Build everything after someone bypassed the CI
216    - if: *is-direct-push
217      when: manual
218    # Build everything in scheduled pipelines
219    - if: *is-scheduled-pipeline
220      when: delayed
221      start_in: *build-delay
222    # Allow building everything in fork pipelines, but build nothing unless
223    # manually triggered
224    - when: manual
225
226
227.ci-deqp-artifacts:
228  artifacts:
229    name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}"
230    when: always
231    untracked: false
232    paths:
233      # Watch out!  Artifacts are relative to the build dir.
234      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
235      - artifacts
236      - _build/meson-logs/*.txt
237      - _build/meson-logs/strace
238
239
240python-artifacts:
241  variables:
242    GIT_DEPTH: 10
243
244
245# Git archive
246make-git-archive:
247  extends:
248    - .fdo.ci-fairy
249  stage: git-archive
250  rules:
251    - !reference [.scheduled_pipeline-rules, rules]
252  tags:
253    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
254  script:
255    # Remove drm-ci files we just added
256    - rm -rf .gitlab-ci.*
257    - rm -rf ci
258
259    # Compactify the .git directory
260    - git gc --aggressive
261    # compress the current folder
262    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
263
264    # Use id_tokens for JWT auth
265    - 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
266
267
268# Sanity checks of MR settings and commit logs
269sanity:
270  extends:
271    - .fdo.ci-fairy
272  stage: sanity
273  tags:
274    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
275  rules:
276    - if: *is-pre-merge
277      when: on_success
278    - when: never
279  variables:
280    GIT_STRATEGY: none
281  script:
282    # ci-fairy check-commits --junit-xml=check-commits.xml
283    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
284    - |
285      set -eu
286      image_tags=(
287        ALPINE_X86_64_LAVA_SSH_TAG
288        CONTAINER_TAG
289        DEBIAN_BASE_TAG
290        DEBIAN_BUILD_TAG
291        DEBIAN_PYUTILS_TAG
292        DEBIAN_TEST_GL_TAG
293        KERNEL_TAG
294        PKG_REPO_REV
295      )
296      for var in "${image_tags[@]}"
297      do
298        if [ "$(echo -n "${!var}" | wc -c)" -gt 20 ]
299        then
300          echo "$var is too long; please make sure it is at most 20 chars."
301          exit 1
302        fi
303      done
304  artifacts:
305    when: on_failure
306    reports:
307      junit: check-*.xml
308
309
310mr-label-maker-test:
311  extends:
312    - .fdo.ci-fairy
313  stage: sanity
314  tags:
315    - $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
316  rules:
317    - !reference [.mr-label-maker-rules, rules]
318  variables:
319    GIT_STRATEGY: fetch
320  timeout: 10m
321  script:
322    - set -eu
323    - python3 -m venv .venv
324    - source .venv/bin/activate
325    - pip install git+https://gitlab.freedesktop.org/freedesktop/mr-label-maker
326    - mr-label-maker --dry-run --mr $CI_MERGE_REQUEST_IID
327
328
329# Jobs that need to pass before spending hardware resources on further testing
330.required-for-hardware-jobs:
331  needs:
332    - job: clang-format
333      optional: true
334    - job: rustfmt
335      optional: true
336    - job: toml-lint
337      optional: true
338
339deploy-docs:
340   rules:
341    - when: never
342
343linkcheck-docs:
344   rules:
345    - when: never
346
347test-docs:
348   rules:
349    - when: never
350