xref: /openbmc/linux/drivers/gpu/drm/ci/gitlab-ci.yml (revision b181f7029bd71238ac2754ce7052dffd69432085)
10119c894STomeu Vizosovariables:
20119c894STomeu Vizoso  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
3101bbe55SHelen Koike  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha edfbf74df1d4d6ce54ffe24566108be0e1a98c3d
40119c894STomeu Vizoso
50119c894STomeu Vizoso  UPSTREAM_REPO: git://anongit.freedesktop.org/drm/drm
60119c894STomeu Vizoso  TARGET_BRANCH: drm-next
70119c894STomeu Vizoso
80119c894STomeu Vizoso  IGT_VERSION: 471bfababd070e1dac0ebb87470ac4f2ae85e663
90119c894STomeu Vizoso
100119c894STomeu Vizoso  DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/anholt/deqp-runner.git
110119c894STomeu Vizoso  DEQP_RUNNER_GIT_TAG: v0.15.0
120119c894STomeu Vizoso
130119c894STomeu Vizoso  FDO_UPSTREAM_REPO: helen.fornazier/linux   # The repo where the git-archive daily runs
140119c894STomeu Vizoso  MESA_TEMPLATES_COMMIT: &ci-templates-commit d5aa3941aa03c2f716595116354fb81eb8012acb
150119c894STomeu Vizoso  DRM_CI_PROJECT_URL: https://gitlab.freedesktop.org/${DRM_CI_PROJECT_PATH}
160119c894STomeu Vizoso  CI_PRE_CLONE_SCRIPT: |-
170119c894STomeu Vizoso          set -o xtrace
180119c894STomeu Vizoso          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
190119c894STomeu Vizoso          bash download-git-cache.sh
200119c894STomeu Vizoso          rm download-git-cache.sh
210119c894STomeu Vizoso          set +o xtrace
220119c894STomeu Vizoso  S3_HOST: s3.freedesktop.org
230119c894STomeu Vizoso  # per-pipeline artifact storage on MinIO
240119c894STomeu Vizoso  PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
250119c894STomeu Vizoso  # per-job artifact storage on MinIO
260119c894STomeu Vizoso  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
27101bbe55SHelen Koike  # default kernel for rootfs before injecting the current kernel tree
28101bbe55SHelen Koike  KERNEL_IMAGE_BASE: https://${S3_HOST}/mesa-lava/gfx-ci/linux/v6.4.12-for-mesa-ci-f6b4ad45f48d
29*aa03f049SHelen Koike  LAVA_TAGS: subset-1-gfx
300119c894STomeu Vizoso  LAVA_JOB_PRIORITY: 30
310119c894STomeu Vizoso
320119c894STomeu Vizosodefault:
330119c894STomeu Vizoso  before_script:
340119c894STomeu Vizoso    - export SCRIPTS_DIR=$(mktemp -d)
350119c894STomeu Vizoso    - 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"
360119c894STomeu Vizoso    - source ${SCRIPTS_DIR}/setup-test-env.sh
370119c894STomeu Vizoso    - echo -e "\e[0Ksection_start:$(date +%s):unset_env_vars_section[collapsed=true]\r\e[0KUnsetting vulnerable environment variables"
380119c894STomeu Vizoso    - export CI_JOB_JWT_FILE="${CI_JOB_JWT_FILE:-$(mktemp)}"
390119c894STomeu Vizoso    - echo -n "${CI_JOB_JWT}" > "${CI_JOB_JWT_FILE}"
400119c894STomeu Vizoso    - unset CI_JOB_JWT
410119c894STomeu Vizoso    - echo -e "\e[0Ksection_end:$(date +%s):unset_env_vars_section\r\e[0K"
420119c894STomeu Vizoso
430119c894STomeu Vizoso    - 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"
440119c894STomeu Vizoso    - cd $CI_PROJECT_DIR
450119c894STomeu Vizoso    - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
460119c894STomeu Vizoso    - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
470119c894STomeu Vizoso    - rm -rf mesa-$DRM_CI_COMMIT_SHA/
480119c894STomeu Vizoso    - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
490119c894STomeu Vizoso
500119c894STomeu Vizoso  after_script:
510119c894STomeu Vizoso    - >
520119c894STomeu Vizoso      set +x
530119c894STomeu Vizoso
540119c894STomeu Vizoso      test -e "${CI_JOB_JWT_FILE}" &&
550119c894STomeu Vizoso      export CI_JOB_JWT="$(<${CI_JOB_JWT_FILE})" &&
560119c894STomeu Vizoso      rm "${CI_JOB_JWT_FILE}"
570119c894STomeu Vizoso
580119c894STomeu Vizoso  # Retry when job fails.
590119c894STomeu Vizoso  retry:
600119c894STomeu Vizoso    max: 1
610119c894STomeu Vizoso    # Ignore runner_unsupported, stale_schedule, archived_failure, or
620119c894STomeu Vizoso    # unmet_prerequisites
630119c894STomeu Vizoso    when:
640119c894STomeu Vizoso      - api_failure
650119c894STomeu Vizoso      - runner_system_failure
660119c894STomeu Vizoso      - script_failure
670119c894STomeu Vizoso      - job_execution_timeout
680119c894STomeu Vizoso      - scheduler_failure
690119c894STomeu Vizoso      - data_integrity_failure
700119c894STomeu Vizoso      - unknown_failure
710119c894STomeu Vizoso
720119c894STomeu Vizosoinclude:
730119c894STomeu Vizoso  - project: 'freedesktop/ci-templates'
740119c894STomeu Vizoso    ref: 16bc29078de5e0a067ff84a1a199a3760d3b3811
750119c894STomeu Vizoso    file:
760119c894STomeu Vizoso      - '/templates/ci-fairy.yml'
770119c894STomeu Vizoso  - project: 'freedesktop/ci-templates'
780119c894STomeu Vizoso    ref: *ci-templates-commit
790119c894STomeu Vizoso    file:
800119c894STomeu Vizoso      - '/templates/alpine.yml'
810119c894STomeu Vizoso      - '/templates/debian.yml'
820119c894STomeu Vizoso      - '/templates/fedora.yml'
830119c894STomeu Vizoso  - project: *drm-ci-project-path
840119c894STomeu Vizoso    ref: *drm-ci-commit-sha
850119c894STomeu Vizoso    file:
860119c894STomeu Vizoso      - '/.gitlab-ci/farm-rules.yml'
870119c894STomeu Vizoso      - '/.gitlab-ci/test-source-dep.yml'
880119c894STomeu Vizoso      - '/.gitlab-ci/container/gitlab-ci.yml'
890119c894STomeu Vizoso      - '/.gitlab-ci/test/gitlab-ci.yml'
900119c894STomeu Vizoso      - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
91101bbe55SHelen Koike      - '/src/microsoft/ci/gitlab-ci-inc.yml'
92101bbe55SHelen Koike      - '/src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'
93101bbe55SHelen Koike      - '/src/gallium/drivers/crocus/ci/gitlab-ci-inc.yml'
94101bbe55SHelen Koike      - '/src/gallium/drivers/softpipe/ci/gitlab-ci-inc.yml'
95101bbe55SHelen Koike      - '/src/gallium/drivers/llvmpipe/ci/gitlab-ci-inc.yml'
96101bbe55SHelen Koike      - '/src/gallium/drivers/virgl/ci/gitlab-ci-inc.yml'
97101bbe55SHelen Koike      - '/src/gallium/drivers/nouveau/ci/gitlab-ci-inc.yml'
98101bbe55SHelen Koike      - '/src/gallium/frontends/lavapipe/ci/gitlab-ci-inc.yml'
99101bbe55SHelen Koike      - '/src/intel/ci/gitlab-ci-inc.yml'
100101bbe55SHelen Koike      - '/src/freedreno/ci/gitlab-ci-inc.yml'
101101bbe55SHelen Koike      - '/src/amd/ci/gitlab-ci-inc.yml'
1020119c894STomeu Vizoso  - drivers/gpu/drm/ci/image-tags.yml
1030119c894STomeu Vizoso  - drivers/gpu/drm/ci/container.yml
1040119c894STomeu Vizoso  - drivers/gpu/drm/ci/static-checks.yml
1050119c894STomeu Vizoso  - drivers/gpu/drm/ci/build.yml
1060119c894STomeu Vizoso  - drivers/gpu/drm/ci/test.yml
1070119c894STomeu Vizoso  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
1080119c894STomeu Vizoso
1090119c894STomeu Vizoso
1100119c894STomeu Vizosostages:
1110119c894STomeu Vizoso  - sanity
1120119c894STomeu Vizoso  - container
1130119c894STomeu Vizoso  - git-archive
1140119c894STomeu Vizoso  - build
1150119c894STomeu Vizoso  - amdgpu
1160119c894STomeu Vizoso  - i915
1170119c894STomeu Vizoso  - mediatek
1180119c894STomeu Vizoso  - meson
1190119c894STomeu Vizoso  - msm
1200119c894STomeu Vizoso  - rockchip
1210119c894STomeu Vizoso  - virtio-gpu
1220119c894STomeu Vizoso  - lint
1230119c894STomeu Vizoso
1240119c894STomeu Vizoso# YAML anchors for rule conditions
1250119c894STomeu Vizoso# --------------------------------
1260119c894STomeu Vizoso.rules-anchors:
1270119c894STomeu Vizoso  rules:
1280119c894STomeu Vizoso    # Pipeline for forked project branch
1290119c894STomeu Vizoso    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
1300119c894STomeu Vizoso      when: manual
1310119c894STomeu Vizoso    # Forked project branch / pre-merge pipeline not for Marge bot
1320119c894STomeu Vizoso    - 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")'
1330119c894STomeu Vizoso      when: manual
1340119c894STomeu Vizoso    # Pipeline runs for the main branch of the upstream Mesa project
1350119c894STomeu Vizoso    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
1360119c894STomeu Vizoso      when: always
1370119c894STomeu Vizoso    # Post-merge pipeline
1380119c894STomeu Vizoso    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
1390119c894STomeu Vizoso      when: on_success
1400119c894STomeu Vizoso    # Post-merge pipeline, not for Marge Bot
1410119c894STomeu Vizoso    - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
1420119c894STomeu Vizoso      when: on_success
1430119c894STomeu Vizoso    # Pre-merge pipeline
1440119c894STomeu Vizoso    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
1450119c894STomeu Vizoso      when: on_success
1460119c894STomeu Vizoso    # Pre-merge pipeline for Marge Bot
1470119c894STomeu Vizoso    - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
1480119c894STomeu Vizoso      when: on_success
1490119c894STomeu Vizoso
1500119c894STomeu Vizoso# Rule to filter for only scheduled pipelines.
1510119c894STomeu Vizoso.scheduled_pipeline-rules:
1520119c894STomeu Vizoso  rules:
1530119c894STomeu Vizoso    - if: &is-scheduled-pipeline '$CI_PIPELINE_SOURCE == "schedule"'
1540119c894STomeu Vizoso      when: on_success
1550119c894STomeu Vizoso
1560119c894STomeu Vizoso# Generic rule to not run the job during scheduled pipelines. Jobs that aren't
1570119c894STomeu Vizoso# something like a nightly run should include this rule.
1580119c894STomeu Vizoso.no_scheduled_pipelines-rules:
1590119c894STomeu Vizoso  rules:
1600119c894STomeu Vizoso    - if: *is-scheduled-pipeline
1610119c894STomeu Vizoso      when: never
1620119c894STomeu Vizoso
1630119c894STomeu Vizoso# When to automatically run the CI for build jobs
1640119c894STomeu Vizoso.build-rules:
1650119c894STomeu Vizoso  rules:
1660119c894STomeu Vizoso    - !reference [.no_scheduled_pipelines-rules, rules]
1670119c894STomeu Vizoso    # Run automatically once all dependency jobs have passed
1680119c894STomeu Vizoso    - when: on_success
1690119c894STomeu Vizoso
170101bbe55SHelen Koike# When to automatically run the CI for container jobs
171101bbe55SHelen Koike.container+build-rules:
172101bbe55SHelen Koike  rules:
173101bbe55SHelen Koike    - !reference [.no_scheduled_pipelines-rules, rules]
174101bbe55SHelen Koike    - when: manual
1750119c894STomeu Vizoso
1760119c894STomeu Vizoso.ci-deqp-artifacts:
1770119c894STomeu Vizoso  artifacts:
1780119c894STomeu Vizoso    name: "mesa_${CI_JOB_NAME}"
1790119c894STomeu Vizoso    when: always
1800119c894STomeu Vizoso    untracked: false
1810119c894STomeu Vizoso    paths:
1820119c894STomeu Vizoso      # Watch out!  Artifacts are relative to the build dir.
1830119c894STomeu Vizoso      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
1840119c894STomeu Vizoso      - artifacts
1850119c894STomeu Vizoso      - _build/meson-logs/*.txt
1860119c894STomeu Vizoso      - _build/meson-logs/strace
1870119c894STomeu Vizoso
1880119c894STomeu Vizoso
1890119c894STomeu Vizoso.container-rules:
1900119c894STomeu Vizoso  rules:
1910119c894STomeu Vizoso    - !reference [.no_scheduled_pipelines-rules, rules]
1920119c894STomeu Vizoso    # Run pipeline by default in the main project if any CI pipeline
1930119c894STomeu Vizoso    # configuration files were changed, to ensure docker images are up to date
1940119c894STomeu Vizoso    - if: *is-post-merge
1950119c894STomeu Vizoso      changes:
1960119c894STomeu Vizoso      - drivers/gpu/drm/ci/**/*
1970119c894STomeu Vizoso      when: on_success
1980119c894STomeu Vizoso    # Run pipeline by default if it was triggered by Marge Bot, is for a
1990119c894STomeu Vizoso    # merge request, and any files affecting the pipeline were changed
2000119c894STomeu Vizoso    - if: *is-pre-merge-for-marge
2010119c894STomeu Vizoso      when: on_success
2020119c894STomeu Vizoso    # Run pipeline by default in the main project if it was not triggered by
2030119c894STomeu Vizoso    # Marge Bot, and any files affecting the pipeline were changed
2040119c894STomeu Vizoso    - if: *is-post-merge-not-for-marge
2050119c894STomeu Vizoso      when: on_success
2060119c894STomeu Vizoso    # Allow triggering jobs manually in other cases
2070119c894STomeu Vizoso    - when: manual
2080119c894STomeu Vizoso
2090119c894STomeu Vizoso
2100119c894STomeu Vizoso
2110119c894STomeu Vizoso# Git archive
2120119c894STomeu Vizoso
2130119c894STomeu Vizosomake git archive:
2140119c894STomeu Vizoso  extends:
2150119c894STomeu Vizoso    - .fdo.ci-fairy
2160119c894STomeu Vizoso  stage: git-archive
2170119c894STomeu Vizoso  rules:
2180119c894STomeu Vizoso    - !reference [.scheduled_pipeline-rules, rules]
2190119c894STomeu Vizoso  # ensure we are running on packet
2200119c894STomeu Vizoso  tags:
2210119c894STomeu Vizoso    - packet.net
2220119c894STomeu Vizoso  script:
2230119c894STomeu Vizoso    # Remove drm-ci files we just added
2240119c894STomeu Vizoso    - rm -rf .gitlab-ci.*
2250119c894STomeu Vizoso
2260119c894STomeu Vizoso    # Compactify the .git directory
2270119c894STomeu Vizoso    - git gc --aggressive
2280119c894STomeu Vizoso    # compress the current folder
2290119c894STomeu Vizoso    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
2300119c894STomeu Vizoso
2310119c894STomeu Vizoso    # login with the JWT token file
2320119c894STomeu Vizoso    - 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
2330119c894STomeu Vizoso
2340119c894STomeu Vizoso
2350119c894STomeu Vizoso# Sanity checks of MR settings and commit logs
2360119c894STomeu Vizososanity:
2370119c894STomeu Vizoso  extends:
2380119c894STomeu Vizoso    - .fdo.ci-fairy
2390119c894STomeu Vizoso  stage: sanity
2400119c894STomeu Vizoso  rules:
2410119c894STomeu Vizoso    - if: *is-pre-merge
2420119c894STomeu Vizoso      when: on_success
2430119c894STomeu Vizoso    # Other cases default to never
2440119c894STomeu Vizoso  variables:
2450119c894STomeu Vizoso    GIT_STRATEGY: none
2460119c894STomeu Vizoso  script:
2470119c894STomeu Vizoso    # ci-fairy check-commits --junit-xml=check-commits.xml
2480119c894STomeu Vizoso    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
2490119c894STomeu Vizoso  artifacts:
2500119c894STomeu Vizoso    when: on_failure
2510119c894STomeu Vizoso    reports:
2520119c894STomeu Vizoso      junit: check-*.xml
2530119c894STomeu Vizoso
2540119c894STomeu Vizoso# Rules for tests that should not block merging, but should be available to
2550119c894STomeu Vizoso# optionally run with the "play" button in the UI in pre-merge non-marge
2560119c894STomeu Vizoso# pipelines.  This should appear in "extends:" after any includes of
2570119c894STomeu Vizoso# test-source-dep.yml rules, so that these rules replace those.
2580119c894STomeu Vizoso.test-manual-mr:
2590119c894STomeu Vizoso  rules:
2600119c894STomeu Vizoso    - !reference [.no_scheduled_pipelines-rules, rules]
2610119c894STomeu Vizoso    - if: *is-forked-branch-or-pre-merge-not-for-marge
2620119c894STomeu Vizoso      when: manual
2630119c894STomeu Vizoso  variables:
2640119c894STomeu Vizoso    JOB_TIMEOUT: 80
2650119c894STomeu Vizoso
2660119c894STomeu Vizoso
2670119c894STomeu Vizoso# Jobs that need to pass before spending hardware resources on further testing
2680119c894STomeu Vizoso.required-for-hardware-jobs:
2690119c894STomeu Vizoso  needs: []