1.test: 2 # Cancel job if a newer commit is pushed to the same branch 3 interruptible: true 4 variables: 5 GIT_STRATEGY: none # testing doesn't build anything from source 6 before_script: 7 - !reference [default, before_script] 8 # Note: Build dir (and thus install) may be dirty due to GIT_STRATEGY 9 - rm -rf install 10 - tar -xf artifacts/install.tar 11 - section_start ldd_section "Checking ldd on driver build" 12 - LD_LIBRARY_PATH=install/lib find install/lib -name "*.so" -print -exec ldd {} \; 13 - section_end ldd_section 14 artifacts: 15 when: always 16 name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" 17 paths: 18 - results/ 19 rules: 20 - !reference [.common-rules, rules] 21 - !reference [.never-post-merge-rules, rules] 22 23.formatting-check: 24 # Cancel job if a newer commit is pushed to the same branch 25 interruptible: true 26 stage: code-validation 27 extends: 28 - .use-debian/x86_64_build 29 variables: 30 GIT_STRATEGY: fetch 31 timeout: 10m 32 script: 33 - git diff --color=always --exit-code # Fails if there are diffs 34 tags: 35 - placeholder-job 36 37rustfmt: 38 extends: 39 - .formatting-check 40 - .lint-rustfmt-rules 41 before_script: 42 - shopt -s globstar 43 - rustfmt --version 44 - rustfmt --verbose src/**/lib.rs 45 46yaml-toml-shell-py-test: 47 extends: 48 - .use-debian/x86_64_pyutils 49 - .no-auto-retry # this job can't be flaky 50 stage: code-validation 51 script: 52 - uncollapsed_section_start tomllint "tomllint" 53 - echo "If your change looks right but this script rejects it, contact @eric (GitLab) / eric_engestrom (IRC)." 54 - python3 bin/toml_lint.py 55 - section_end tomllint 56 - section_start yamllint "yamllint" 57 - .gitlab-ci/run-yamllint.sh 58 - section_end yamllint 59 - section_start shellcheck "shellcheck" 60 - .gitlab-ci/run-shellcheck.sh 61 - section_end shellcheck 62 - .gitlab-ci/run-pytest.sh 63 rules: 64 - !reference [.disable-farm-mr-rules, rules] 65 - !reference [.never-post-merge-rules, rules] 66 - !reference [.no_scheduled_pipelines-rules, rules] 67 # merge pipeline 68 - if: $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event" 69 changes: &lint_files 70 - .gitlab-ci/test/gitlab-ci.yml 71 - .gitlab-ci/**/*.sh 72 - .shellcheckrc 73 - bin/toml_lint.py 74 - src/**/ci/*.toml 75 - .gitlab-ci/tests/**/* 76 - bin/ci/**/* 77 when: on_success 78 # direct pushes that bypassed the CI 79 - if: $CI_PROJECT_NAMESPACE == "mesa" && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH 80 changes: *lint_files 81 when: on_success 82 # direct pushes from release manager 83 - if: $CI_PROJECT_NAMESPACE == "mesa" && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /^staging\// 84 changes: *lint_files 85 when: on_success 86 - changes: *lint_files 87 when: manual 88 tags: 89 - placeholder-job 90 91.test-gl: 92 extends: 93 - .test 94 - .use-debian/x86_64_test-gl 95 needs: 96 - debian/x86_64_test-gl 97 - debian-testing 98 - !reference [.required-for-hardware-jobs, needs] 99 variables: 100 DEBIAN_ARCH: amd64 101 102.test-vk: 103 extends: 104 - .test 105 - .use-debian/x86_64_test-vk 106 needs: 107 - debian-testing 108 - debian/x86_64_test-vk 109 - !reference [.required-for-hardware-jobs, needs] 110 variables: 111 DEBIAN_ARCH: amd64 112 113.test-cl: 114 extends: 115 - .test 116 - .use-debian/x86_64_test-gl 117 needs: 118 - debian/x86_64_test-gl 119 - !reference [.required-for-hardware-jobs, needs] 120 121.test-android: 122 extends: 123 - .test 124 - .use-debian/x86_64_test-android 125 variables: 126 # This is for the guest artifacts from debian-android which will be 127 # downloaded explicitly by cuttlefish-runner.sh 128 S3_ANDROID_ARTIFACT_NAME: mesa-x86_64-android-debug 129 # Set the default Vulkan driver to lavapipe for some preliminary checks 130 # that Cuttlefish always performs before starting the VM. This can be 131 # overwritten depending on the physical machine running the job. 132 VK_DRIVER: "lvp" 133 needs: 134 - job: debian-testing 135 artifacts: true # On the host we want the Linux build 136 - job: debian-android 137 artifacts: false # The Android build will be downloaded later 138 - job: debian/x86_64_test-android 139 artifacts: false 140 - !reference [.required-for-hardware-jobs, needs] 141 timeout: 20m 142 script: 143 - ./install/cuttlefish-runner.sh 144 artifacts: 145 paths: 146 - results/ 147 148.b2c-vkd3d-proton-test: 149 variables: 150 HWCI_TEST_SCRIPT: install/vkd3d-runner.sh 151 152.piglit-traces-test: 153 artifacts: 154 when: on_failure 155 name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" 156 reports: 157 junit: results/junit.xml 158 paths: 159 - results/ 160 exclude: 161 - results/*.shader_cache 162 variables: 163 # until we overcome Infrastructure issues, give traces extra 5 min before timeout 164 DEVICE_HANGING_TIMEOUT_SEC: 600 165 PIGLIT_REPLAY_EXTRA_ARGS: --db-path ${CI_PROJECT_DIR}/replayer-db/ --minio_bucket=${S3_TRACIE_PUBLIC_BUCKET} --jwt-file=${S3_JWT_FILE} 166 PIGLIT_NO_WINDOW: 1 167 HWCI_TEST_SCRIPT: "/install/piglit/piglit-runner.sh" 168 script: 169 - section_start variables "Variables passed through:" 170 - install/common/generate-env.sh 171 - section_end variables 172 - install/piglit/piglit-traces.sh 173 174.deqp-test: 175 script: 176 - rm -rf results # Clear out old results if the docker container was cached 177 - ./install/deqp-runner.sh 178 artifacts: 179 exclude: 180 - results/*.shader_cache 181 reports: 182 junit: results/junit.xml 183 184.fossilize-test: 185 script: 186 - ./install/fossilize-runner.sh 187 artifacts: 188 when: on_failure 189 name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" 190 paths: 191 - results/ 192 193.download_s3: 194 before_script: 195 - !reference [default, before_script] 196 # Use this instead of gitlab's artifacts download because it hits packet.net 197 # instead of fd.o. Set FDO_HTTP_CACHE_URI to an http cache for your test lab to 198 # improve it even more (see https://docs.mesa3d.org/ci/bare-metal.html for 199 # setup). 200 - section_start artifacts_download "Downloading artifacts from s3" 201 # Note: Build dir (and thus install) may be dirty due to GIT_STRATEGY 202 - rm -rf install 203 - (set -x; curl -L --retry 4 -f --retry-all-errors --retry-delay 60 ${FDO_HTTP_CACHE_URI:-}https://${PIPELINE_ARTIFACTS_BASE}/${S3_ARTIFACT_NAME}.tar.zst | tar --zstd -x) 204 - section_end artifacts_download 205 206.baremetal-test: 207 extends: 208 - .test 209 # Cancel job if a newer commit is pushed to the same branch 210 interruptible: true 211 before_script: 212 - !reference [.download_s3, before_script] 213 variables: 214 BM_ROOTFS: /rootfs-${DEBIAN_ARCH} 215 artifacts: 216 when: always 217 name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" 218 paths: 219 - results/ 220 - serial*.txt 221 exclude: 222 - results/*.shader_cache 223 reports: 224 junit: results/junit.xml 225 226# ARM testing of bare-metal boards attached to an x86 gitlab-runner system 227.baremetal-test-arm32: 228 extends: 229 - .baremetal-test 230 - .use-debian/baremetal_arm32_test 231 variables: 232 DEBIAN_ARCH: armhf 233 S3_ARTIFACT_NAME: mesa-arm32-default-debugoptimized 234 needs: 235 - debian/baremetal_arm32_test 236 - job: debian-arm32 237 artifacts: false 238 - !reference [.required-for-hardware-jobs, needs] 239 240# ARM64 testing of bare-metal boards attached to an x86 gitlab-runner system 241.baremetal-test-arm64: 242 extends: 243 - .baremetal-test 244 - .use-debian/baremetal_arm64_test 245 variables: 246 DEBIAN_ARCH: arm64 247 S3_ARTIFACT_NAME: mesa-arm64-default-debugoptimized 248 needs: 249 - debian/baremetal_arm64_test 250 - job: debian-arm64 251 artifacts: false 252 - !reference [.required-for-hardware-jobs, needs] 253 254# ARM32/64 testing of bare-metal boards attached to an x86 gitlab-runner system, using an asan mesa build 255.baremetal-arm32-asan-test: 256 variables: 257 S3_ARTIFACT_NAME: mesa-arm32-asan-debugoptimized 258 DEQP_FORCE_ASAN: 1 259 needs: 260 - debian/baremetal_arm32_test 261 - job: debian-arm32-asan 262 artifacts: false 263 - !reference [.required-for-hardware-jobs, needs] 264 265.baremetal-arm64-asan-test: 266 variables: 267 S3_ARTIFACT_NAME: mesa-arm64-asan-debugoptimized 268 DEQP_FORCE_ASAN: 1 269 needs: 270 - debian/baremetal_arm64_test 271 - job: debian-arm64-asan 272 artifacts: false 273 - !reference [.required-for-hardware-jobs, needs] 274 275.baremetal-arm64-ubsan-test: 276 extends: 277 - .baremetal-test 278 - .use-debian/baremetal_arm64_test 279 variables: 280 S3_ARTIFACT_NAME: mesa-arm64-ubsan-debugoptimized 281 needs: 282 - debian/baremetal_arm64_test 283 - job: debian-arm64-ubsan 284 artifacts: false 285 - !reference [.required-for-hardware-jobs, needs] 286 287.baremetal-deqp-test: 288 variables: 289 HWCI_TEST_SCRIPT: "/install/deqp-runner.sh" 290 FDO_CI_CONCURRENT: 0 # Default to number of CPUs 291 292# For Valve's bare-metal testing farm jobs. 293.b2c-test: 294 # It would be nice to use ci-templates within Mesa CI for this job's 295 # image:, but the integration is not possible for the current 296 # use-case. Within this job, two containers are managed. 1) the 297 # gitlab runner container from which the job is submitted to the 298 # DUT, and 2) the test container (e.g. debian/x86_64_test-vk) within 299 # which the test cases will run on the DUT. Since ci-templates and 300 # the associated image setting macros in this file rely on variables 301 # like FDO_DISTRIBUTION_TAG for *the* image, there is no way to 302 # depend on more than one image per job. So, the job container is 303 # built as part of the CI in the boot2container project. 304 image: registry.freedesktop.org/gfx-ci/ci-tron/mesa-trigger:2024-01-05.1 305 timeout: 1h 40m 306 variables: 307 # No need by default to pull the whole repo 308 GIT_STRATEGY: none 309 # boot2container initrd configuration parameters. 310 B2C_VERSION: v0.9.14 311 B2C_JOB_SUCCESS_REGEX: 'hwci: mesa: pass, exit_code: 0\r$' 312 B2C_LOG_LEVEL: 6 313 B2C_POWEROFF_DELAY: 15 314 B2C_SESSION_END_REGEX: '^.*It''s now safe to turn off your computer\r$' 315 B2C_SESSION_REBOOT_REGEX: '' 316 B2C_TIMEOUT_BOOT_MINUTES: 45 317 B2C_TIMEOUT_BOOT_RETRIES: 0 318 B2C_TIMEOUT_FIRST_CONSOLE_ACTIVITY_MINUTES: 2 319 B2C_TIMEOUT_FIRST_CONSOLE_ACTIVITY_RETRIES: 3 320 B2C_TIMEOUT_CONSOLE_ACTIVITY_MINUTES: 5 321 B2C_TIMEOUT_OVERALL_MINUTES: 90 322 B2C_TIMEOUT_CONSOLE_ACTIVITY_RETRIES: 0 323 B2C_JOB_VOLUME_EXCLUSIONS: "*.shader_cache,install/*,*/install/*,*/vkd3d-proton.cache*,vkd3d-proton.cache*,*.qpa" 324 325 # As noted in the top description, we make a distinction between the 326 # container used by gitlab-runner to queue the work, and the container 327 # used by the DUTs/test machines. To make this distinction quite clear, 328 # we rename the MESA_IMAGE variable into IMAGE_UNDER_TEST. 329 IMAGE_UNDER_TEST: "$MESA_IMAGE" 330 331 INSTALL_TARBALL_NAME: "install.tar" 332 INSTALL_TARBALL: "./artifacts/${INSTALL_TARBALL_NAME}" 333 CI_B2C_ARTIFACTS: "./artifacts/b2c" 334 CI_COMMON_SCRIPTS: "./artifacts/ci-common" 335 B2C_JOB_TEMPLATE: "${CI_B2C_ARTIFACTS}/b2c.yml.jinja2.jinja2" 336 JOB_FOLDER: "job_folder" 337 338 before_script: 339 # We don't want the tarball unpacking of .test, but will take the JWT bits. 340 - !reference [default, before_script] 341 342 - | 343 set -eux 344 345 section_start b2c_kernel_boot "Booting hardware device" 346 347 # Useful as a hook point for runner admins. You may edit the 348 # config.toml for the Gitlab runner and use a bind-mount to 349 # populate the hook script with some executable commands. This 350 # allows quicker feedback than resubmitting pipelines and 351 # potentially having to wait for a debug build of Mesa to 352 # complete. 353 if [ -x /runner-before-script.sh ]; then 354 echo "Executing runner before-script hook..." 355 sh /runner-before-script.sh 356 if [ $? -ne 0 ]; then 357 echo "Runner hook failed, goodbye" 358 exit $? 359 fi 360 fi 361 362 [ -s "$INSTALL_TARBALL" ] || exit 1 363 [ -d "$CI_B2C_ARTIFACTS" ] || exit 1 364 [ -d "$CI_COMMON_SCRIPTS" ] || exit 1 365 366 export B2C_CONTAINER_CMD="bash -euc 'tar xf ${INSTALL_TARBALL_NAME}; ./install/common/init-stage2.sh'" 367 368 # The Valve CI gateway receives jobs in a YAML format. Create a 369 # job description from the CI environment. 370 python3 "$CI_B2C_ARTIFACTS"/generate_b2c.py 371 372 cat b2c.yml.jinja2 373 374 rm -rf ${JOB_FOLDER} || true 375 mkdir -v ${JOB_FOLDER} 376 377 # Create a script to regenerate the CI environment when this job 378 # begins running on the remote DUT. 379 set +x 380 "$CI_COMMON_SCRIPTS"/generate-env.sh > ${JOB_FOLDER}/set-job-env-vars.sh 381 echo "export SCRIPTS_DIR=./install" >> ${JOB_FOLDER}/set-job-env-vars.sh 382 echo "Variables passed through:" 383 cat ${JOB_FOLDER}/set-job-env-vars.sh 384 set -x 385 386 # Copy the mesa install tarball to the job folder, for later extraction 387 mv "${INSTALL_TARBALL}" "${JOB_FOLDER}" 388 389 script: | 390 slugify () { 391 echo "$1" | sed -r s/[~\^]+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z 392 } 393 394 # Submit the job to Valve's CI gateway service with the CI 395 # provisioned job_folder. 396 env PYTHONUNBUFFERED=1 executorctl \ 397 run -w b2c.yml.jinja2 -j $(slugify "$CI_JOB_NAME") -s ${JOB_FOLDER} -i "$CI_RUNNER_DESCRIPTION" 398 399 # Anything our job places in results/ will be collected by the 400 # Gitlab coordinator for status presentation. results/junit.xml 401 # will be parsed by the UI for more detailed explanations of 402 # test execution. 403 after_script: 404 # Keep the results path the same as baremetal and LAVA 405 - mkdir -p "${JOB_FOLDER}"/results 406 - mv "${JOB_FOLDER}"/results ./ 407 - !reference [default, after_script] 408 409 artifacts: 410 when: always 411 name: "${CI_PROJECT_NAME}_${CI_JOB_NAME}" 412 paths: 413 - results 414 reports: 415 junit: results/**/junit.xml 416 417.b2c-x86_64-test: 418 extends: 419 - .b2c-test 420 variables: 421 B2C_KERNEL_URL: 'https://gitlab.freedesktop.org/gfx-ci/ci-tron/-/package_files/519/download' # Linux 6.1 422 B2C_INITRAMFS_URL: 'https://gitlab.freedesktop.org/gfx-ci/boot2container/-/releases/${B2C_VERSION}/downloads/initramfs.linux_amd64.cpio.xz' 423 424.b2c-x86_64-test-vk: 425 extends: 426 - .use-debian/x86_64_test-vk 427 - .b2c-x86_64-test 428 needs: 429 - debian/x86_64_test-vk 430 - debian-testing 431 - !reference [.required-for-hardware-jobs, needs] 432 433.b2c-x86_64-test-vk-manual: 434 extends: 435 - .use-debian/x86_64_test-vk 436 - .b2c-x86_64-test 437 variables: 438 S3_ARTIFACT_NAME: "debian-build-testing" 439 needs: 440 - debian/x86_64_test-vk 441 - debian-build-testing 442 - !reference [.required-for-hardware-jobs, needs] 443 444.b2c-x86_64-test-gl: 445 extends: 446 - .use-debian/x86_64_test-gl 447 - .b2c-x86_64-test 448 needs: 449 - debian/x86_64_test-gl 450 - debian-testing 451 - !reference [.required-for-hardware-jobs, needs] 452 453.b2c-x86_64-test-gl-manual: 454 extends: 455 - .use-debian/x86_64_test-gl 456 - .b2c-x86_64-test 457 variables: 458 S3_ARTIFACT_NAME: "debian-build-testing" 459 needs: 460 - debian/x86_64_test-gl 461 - debian-build-testing 462 - !reference [.required-for-hardware-jobs, needs] 463 464.b2c-arm64-test: 465 extends: 466 - .b2c-test 467 variables: 468 B2C_INITRAMFS_URL: 'https://gitlab.freedesktop.org/gfx-ci/boot2container/-/releases/${B2C_VERSION}/downloads/initramfs.linux_arm64.cpio.xz' 469 B2C_KERNEL_URL: 'https://gitlab.freedesktop.org/gfx-ci/boot2container/-/releases/${B2C_VERSION}/downloads/linux-arm64' 470 471.b2c-arm64-test-vk: 472 extends: 473 - .use-debian/arm64_test-vk 474 - .b2c-arm64-test 475 needs: 476 - debian/arm64_test-vk 477 - debian-arm64 478 - !reference [.required-for-hardware-jobs, needs] 479 480.b2c-arm64-test-gl: 481 extends: 482 - .use-debian/arm64_test-gl 483 - .b2c-arm64-test 484 needs: 485 - debian/arm64_test-gl 486 - debian-arm64 487 - !reference [.required-for-hardware-jobs, needs] 488