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