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