gitlab-ci.yml 11 KB

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