xref: /linux/drivers/gpu/drm/ci/gitlab-ci.yml (revision e7d759f31ca295d589f7420719c311870bb3166f)
1variables:
2  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
3  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha edfbf74df1d4d6ce54ffe24566108be0e1a98c3d
4
5  UPSTREAM_REPO: git://anongit.freedesktop.org/drm/drm
6  TARGET_BRANCH: drm-next
7
8  IGT_VERSION: d2af13d9f5be5ce23d996e4afd3e45990f5ab977
9
10  DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/anholt/deqp-runner.git
11  DEQP_RUNNER_GIT_TAG: v0.15.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_HOST: s3.freedesktop.org
23  # per-pipeline artifact storage on MinIO
24  PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
25  # per-job artifact storage on MinIO
26  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
27  # default kernel for rootfs before injecting the current kernel tree
28  KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/gfx-ci/linux/v6.4.12-for-mesa-ci-f6b4ad45f48d
29  LAVA_TAGS: subset-1-gfx
30  LAVA_JOB_PRIORITY: 30
31
32default:
33  before_script:
34    - export SCRIPTS_DIR=$(mktemp -d)
35    - 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"
36    - source ${SCRIPTS_DIR}/setup-test-env.sh
37    - echo -e "\e[0Ksection_start:$(date +%s):unset_env_vars_section[collapsed=true]\r\e[0KUnsetting vulnerable environment variables"
38    - export CI_JOB_JWT_FILE="${CI_JOB_JWT_FILE:-$(mktemp)}"
39    - echo -n "${CI_JOB_JWT}" > "${CI_JOB_JWT_FILE}"
40    - unset CI_JOB_JWT
41    - echo -e "\e[0Ksection_end:$(date +%s):unset_env_vars_section\r\e[0K"
42
43    - 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"
44    - cd $CI_PROJECT_DIR
45    - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
46    - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
47    - rm -rf mesa-$DRM_CI_COMMIT_SHA/
48    - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
49
50  after_script:
51    - >
52      set +x
53
54      test -e "${CI_JOB_JWT_FILE}" &&
55      export CI_JOB_JWT="$(<${CI_JOB_JWT_FILE})" &&
56      rm "${CI_JOB_JWT_FILE}"
57
58include:
59  - project: 'freedesktop/ci-templates'
60    ref: 16bc29078de5e0a067ff84a1a199a3760d3b3811
61    file:
62      - '/templates/ci-fairy.yml'
63  - project: 'freedesktop/ci-templates'
64    ref: *ci-templates-commit
65    file:
66      - '/templates/alpine.yml'
67      - '/templates/debian.yml'
68      - '/templates/fedora.yml'
69  - project: *drm-ci-project-path
70    ref: *drm-ci-commit-sha
71    file:
72      - '/.gitlab-ci/farm-rules.yml'
73      - '/.gitlab-ci/test-source-dep.yml'
74      - '/.gitlab-ci/container/gitlab-ci.yml'
75      - '/.gitlab-ci/test/gitlab-ci.yml'
76      - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
77      - '/src/microsoft/ci/gitlab-ci-inc.yml'
78      - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
79      - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
80      - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
81      - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
82      - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
83      - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
84      - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
85      - '/src/intel/ci/gitlab-ci-inc.yml'
86      - '/src/freedreno/ci/gitlab-ci-inc.yml'
87      - '/src/amd/ci/gitlab-ci-inc.yml'
88  - drivers/gpu/drm/ci/image-tags.yml
89  - drivers/gpu/drm/ci/container.yml
90  - drivers/gpu/drm/ci/static-checks.yml
91  - drivers/gpu/drm/ci/build.yml
92  - drivers/gpu/drm/ci/test.yml
93  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
94
95
96stages:
97  - sanity
98  - container
99  - git-archive
100  - build
101  - amdgpu
102  - i915
103  - mediatek
104  - meson
105  - msm
106  - rockchip
107  - virtio-gpu
108  - lint
109
110# YAML anchors for rule conditions
111# --------------------------------
112.rules-anchors:
113  rules:
114    # Pipeline for forked project branch
115    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
116      when: manual
117    # Forked project branch / pre-merge pipeline not for Marge bot
118    - 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")'
119      when: manual
120    # Pipeline runs for the main branch of the upstream Mesa project
121    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
122      when: always
123    # Post-merge pipeline
124    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
125      when: on_success
126    # Post-merge pipeline, not for Marge Bot
127    - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
128      when: on_success
129    # Pre-merge pipeline
130    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
131      when: on_success
132    # Pre-merge pipeline for Marge Bot
133    - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
134      when: on_success
135
136# Rule to filter for only scheduled pipelines.
137.scheduled_pipeline-rules:
138  rules:
139    - if: &is-scheduled-pipeline '$CI_PIPELINE_SOURCE == "schedule"'
140      when: on_success
141
142# Generic rule to not run the job during scheduled pipelines. Jobs that aren't
143# something like a nightly run should include this rule.
144.no_scheduled_pipelines-rules:
145  rules:
146    - if: *is-scheduled-pipeline
147      when: never
148
149# When to automatically run the CI for build jobs
150.build-rules:
151  rules:
152    - !reference [.no_scheduled_pipelines-rules, rules]
153    # Run automatically once all dependency jobs have passed
154    - when: on_success
155
156# When to automatically run the CI for container jobs
157.container+build-rules:
158  rules:
159    - !reference [.no_scheduled_pipelines-rules, rules]
160    - when: manual
161
162.ci-deqp-artifacts:
163  artifacts:
164    name: "mesa_${CI_JOB_NAME}"
165    when: always
166    untracked: false
167    paths:
168      # Watch out!  Artifacts are relative to the build dir.
169      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
170      - artifacts
171      - _build/meson-logs/*.txt
172      - _build/meson-logs/strace
173
174
175.container-rules:
176  rules:
177    - !reference [.no_scheduled_pipelines-rules, rules]
178    # Run pipeline by default in the main project if any CI pipeline
179    # configuration files were changed, to ensure docker images are up to date
180    - if: *is-post-merge
181      changes:
182      - drivers/gpu/drm/ci/**/*
183      when: on_success
184    # Run pipeline by default if it was triggered by Marge Bot, is for a
185    # merge request, and any files affecting the pipeline were changed
186    - if: *is-pre-merge-for-marge
187      when: on_success
188    # Run pipeline by default in the main project if it was not triggered by
189    # Marge Bot, and any files affecting the pipeline were changed
190    - if: *is-post-merge-not-for-marge
191      when: on_success
192    # Allow triggering jobs manually in other cases
193    - when: manual
194
195
196
197# Git archive
198
199make git archive:
200  extends:
201    - .fdo.ci-fairy
202  stage: git-archive
203  rules:
204    - !reference [.scheduled_pipeline-rules, rules]
205  # ensure we are running on packet
206  tags:
207    - packet.net
208  script:
209    # Remove drm-ci files we just added
210    - rm -rf .gitlab-ci.*
211
212    # Compactify the .git directory
213    - git gc --aggressive
214    # compress the current folder
215    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
216
217    # login with the JWT token file
218    - ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ../$CI_PROJECT_NAME.tar.gz https://$S3_HOST/git-cache/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$CI_PROJECT_NAME.tar.gz
219
220
221# Sanity checks of MR settings and commit logs
222sanity:
223  extends:
224    - .fdo.ci-fairy
225  stage: sanity
226  rules:
227    - if: *is-pre-merge
228      when: on_success
229    # Other cases default to never
230  variables:
231    GIT_STRATEGY: none
232  script:
233    # ci-fairy check-commits --junit-xml=check-commits.xml
234    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
235  artifacts:
236    when: on_failure
237    reports:
238      junit: check-*.xml
239
240# Rules for tests that should not block merging, but should be available to
241# optionally run with the "play" button in the UI in pre-merge non-marge
242# pipelines.  This should appear in "extends:" after any includes of
243# test-source-dep.yml rules, so that these rules replace those.
244.test-manual-mr:
245  rules:
246    - !reference [.no_scheduled_pipelines-rules, rules]
247    - if: *is-forked-branch-or-pre-merge-not-for-marge
248      when: manual
249  variables:
250    JOB_TIMEOUT: 80
251
252
253# Jobs that need to pass before spending hardware resources on further testing
254.required-for-hardware-jobs:
255  needs: []