1variables:
2  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
3  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha 7d3062470f3ccc6cb40540e772e902c7e2248024
4
5  UPSTREAM_REPO: https://gitlab.freedesktop.org/drm/kernel.git
6  TARGET_BRANCH: drm-next
7
8  IGT_VERSION: 33adea9ebafd059ac88a5ccfec60536394f36c7c
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_PROJECT_NAMESPACE != "mesa" && $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_PROJECT_NAMESPACE == "mesa" && $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, if any files affecting the pipeline
174    # were changed
175    - if: *is-merge-attempt
176      changes: &all_paths
177      - drivers/gpu/drm/ci/**/*
178      when: on_success
179    # Same as above, but for pre-merge pipelines
180    - if: *is-pre-merge
181      changes:
182        *all_paths
183      when: manual
184    # Skip everything for pre-merge and merge pipelines which don't change
185    # anything in the build
186    - if: *is-merge-attempt
187      when: never
188    - if: *is-pre-merge
189      when: never
190    # Build everything after someone bypassed the CI
191    - if: *is-direct-push
192      when: on_success
193    # Build everything in scheduled pipelines
194    - if: *is-scheduled-pipeline
195      when: on_success
196    # Allow building everything in fork pipelines, but build nothing unless
197    # manually triggered
198    - when: manual
199
200
201.ci-deqp-artifacts:
202  artifacts:
203    name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}"
204    when: always
205    untracked: false
206    paths:
207      # Watch out!  Artifacts are relative to the build dir.
208      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
209      - artifacts
210      - _build/meson-logs/*.txt
211      - _build/meson-logs/strace
212
213
214# Git archive
215make git archive:
216  extends:
217    - .fdo.ci-fairy
218  stage: git-archive
219  rules:
220    - !reference [.scheduled_pipeline-rules, rules]
221  # ensure we are running on packet
222  tags:
223    - packet.net
224  script:
225    # Remove drm-ci files we just added
226    - rm -rf .gitlab-ci.*
227    - rm -rf ci
228
229    # Compactify the .git directory
230    - git gc --aggressive
231    # compress the current folder
232    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
233
234    # Use id_tokens for JWT auth
235    - 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
236
237
238# Sanity checks of MR settings and commit logs
239sanity:
240  extends:
241    - .fdo.ci-fairy
242  stage: sanity
243  rules:
244    - if: *is-pre-merge
245      when: on_success
246    - when: never
247  variables:
248    GIT_STRATEGY: none
249  script:
250    # ci-fairy check-commits --junit-xml=check-commits.xml
251    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
252    - |
253      set -eu
254      image_tags=(
255        ALPINE_X86_64_LAVA_SSH_TAG
256        CONTAINER_TAG
257        DEBIAN_BASE_TAG
258        DEBIAN_BUILD_TAG
259        DEBIAN_PYUTILS_TAG
260        DEBIAN_TEST_GL_TAG
261        KERNEL_ROOTFS_TAG
262        KERNEL_TAG
263        PKG_REPO_REV
264      )
265      for var in "${image_tags[@]}"
266      do
267        if [ "$(echo -n "${!var}" | wc -c)" -gt 20 ]
268        then
269          echo "$var is too long; please make sure it is at most 20 chars."
270          exit 1
271        fi
272      done
273  artifacts:
274    when: on_failure
275    reports:
276      junit: check-*.xml
277  tags:
278    - placeholder-job
279
280
281mr-label-maker-test:
282  extends:
283    - .fdo.ci-fairy
284  stage: sanity
285  rules:
286    - !reference [.mr-label-maker-rules, rules]
287  variables:
288    GIT_STRATEGY: fetch
289  timeout: 10m
290  script:
291    - set -eu
292    - python3 -m venv .venv
293    - source .venv/bin/activate
294    - pip install git+https://gitlab.freedesktop.org/freedesktop/mr-label-maker
295    - mr-label-maker --dry-run --mr $CI_MERGE_REQUEST_IID
296
297
298# Jobs that need to pass before spending hardware resources on further testing
299.required-for-hardware-jobs:
300  needs:
301    - job: clang-format
302      optional: true
303    - job: rustfmt
304      optional: true
305    - job: toml-lint
306      optional: true
307