xref: /openbmc/linux/drivers/gpu/drm/ci/gitlab-ci.yml (revision 93696d8f)
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: 471bfababd070e1dac0ebb87470ac4f2ae85e663
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
58  # Retry when job fails.
59  retry:
60    max: 1
61    # Ignore runner_unsupported, stale_schedule, archived_failure, or
62    # unmet_prerequisites
63    when:
64      - api_failure
65      - runner_system_failure
66      - script_failure
67      - job_execution_timeout
68      - scheduler_failure
69      - data_integrity_failure
70      - unknown_failure
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/farm-rules.yml'
87      - '/.gitlab-ci/test-source-dep.yml'
88      - '/.gitlab-ci/container/gitlab-ci.yml'
89      - '/.gitlab-ci/test/gitlab-ci.yml'
90      - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
91      - '/src/microsoft/ci/gitlab-ci-inc.yml'
92      - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
93      - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
94      - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
95      - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
96      - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
97      - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
98      - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
99      - '/src/intel/ci/gitlab-ci-inc.yml'
100      - '/src/freedreno/ci/gitlab-ci-inc.yml'
101      - '/src/amd/ci/gitlab-ci-inc.yml'
102  - drivers/gpu/drm/ci/image-tags.yml
103  - drivers/gpu/drm/ci/container.yml
104  - drivers/gpu/drm/ci/static-checks.yml
105  - drivers/gpu/drm/ci/build.yml
106  - drivers/gpu/drm/ci/test.yml
107  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
108
109
110stages:
111  - sanity
112  - container
113  - git-archive
114  - build
115  - amdgpu
116  - i915
117  - mediatek
118  - meson
119  - msm
120  - rockchip
121  - virtio-gpu
122  - lint
123
124# YAML anchors for rule conditions
125# --------------------------------
126.rules-anchors:
127  rules:
128    # Pipeline for forked project branch
129    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
130      when: manual
131    # Forked project branch / pre-merge pipeline not for Marge bot
132    - 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")'
133      when: manual
134    # Pipeline runs for the main branch of the upstream Mesa project
135    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
136      when: always
137    # Post-merge pipeline
138    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
139      when: on_success
140    # Post-merge pipeline, not for Marge Bot
141    - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
142      when: on_success
143    # Pre-merge pipeline
144    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
145      when: on_success
146    # Pre-merge pipeline for Marge Bot
147    - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
148      when: on_success
149
150# Rule to filter for only scheduled pipelines.
151.scheduled_pipeline-rules:
152  rules:
153    - if: &is-scheduled-pipeline '$CI_PIPELINE_SOURCE == "schedule"'
154      when: on_success
155
156# Generic rule to not run the job during scheduled pipelines. Jobs that aren't
157# something like a nightly run should include this rule.
158.no_scheduled_pipelines-rules:
159  rules:
160    - if: *is-scheduled-pipeline
161      when: never
162
163# When to automatically run the CI for build jobs
164.build-rules:
165  rules:
166    - !reference [.no_scheduled_pipelines-rules, rules]
167    # Run automatically once all dependency jobs have passed
168    - when: on_success
169
170# When to automatically run the CI for container jobs
171.container+build-rules:
172  rules:
173    - !reference [.no_scheduled_pipelines-rules, rules]
174    - when: manual
175
176.ci-deqp-artifacts:
177  artifacts:
178    name: "mesa_${CI_JOB_NAME}"
179    when: always
180    untracked: false
181    paths:
182      # Watch out!  Artifacts are relative to the build dir.
183      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
184      - artifacts
185      - _build/meson-logs/*.txt
186      - _build/meson-logs/strace
187
188
189.container-rules:
190  rules:
191    - !reference [.no_scheduled_pipelines-rules, rules]
192    # Run pipeline by default in the main project if any CI pipeline
193    # configuration files were changed, to ensure docker images are up to date
194    - if: *is-post-merge
195      changes:
196      - drivers/gpu/drm/ci/**/*
197      when: on_success
198    # Run pipeline by default if it was triggered by Marge Bot, is for a
199    # merge request, and any files affecting the pipeline were changed
200    - if: *is-pre-merge-for-marge
201      when: on_success
202    # Run pipeline by default in the main project if it was not triggered by
203    # Marge Bot, and any files affecting the pipeline were changed
204    - if: *is-post-merge-not-for-marge
205      when: on_success
206    # Allow triggering jobs manually in other cases
207    - when: manual
208
209
210
211# Git archive
212
213make git archive:
214  extends:
215    - .fdo.ci-fairy
216  stage: git-archive
217  rules:
218    - !reference [.scheduled_pipeline-rules, rules]
219  # ensure we are running on packet
220  tags:
221    - packet.net
222  script:
223    # Remove drm-ci files we just added
224    - rm -rf .gitlab-ci.*
225
226    # Compactify the .git directory
227    - git gc --aggressive
228    # compress the current folder
229    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
230
231    # login with the JWT token file
232    - 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
233
234
235# Sanity checks of MR settings and commit logs
236sanity:
237  extends:
238    - .fdo.ci-fairy
239  stage: sanity
240  rules:
241    - if: *is-pre-merge
242      when: on_success
243    # Other cases default to never
244  variables:
245    GIT_STRATEGY: none
246  script:
247    # ci-fairy check-commits --junit-xml=check-commits.xml
248    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
249  artifacts:
250    when: on_failure
251    reports:
252      junit: check-*.xml
253
254# Rules for tests that should not block merging, but should be available to
255# optionally run with the "play" button in the UI in pre-merge non-marge
256# pipelines.  This should appear in "extends:" after any includes of
257# test-source-dep.yml rules, so that these rules replace those.
258.test-manual-mr:
259  rules:
260    - !reference [.no_scheduled_pipelines-rules, rules]
261    - if: *is-forked-branch-or-pre-merge-not-for-marge
262      when: manual
263  variables:
264    JOB_TIMEOUT: 80
265
266
267# Jobs that need to pass before spending hardware resources on further testing
268.required-for-hardware-jobs:
269  needs: []