162306a36Sopenharmony_civariables:
262306a36Sopenharmony_ci  DRM_CI_PROJECT_PATH: &drm-ci-project-path mesa/mesa
362306a36Sopenharmony_ci  DRM_CI_COMMIT_SHA: &drm-ci-commit-sha 0dc961645c4f0241f8512cb0ec3ad59635842072
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci  UPSTREAM_REPO: git://anongit.freedesktop.org/drm/drm
662306a36Sopenharmony_ci  TARGET_BRANCH: drm-next
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci  IGT_VERSION: 471bfababd070e1dac0ebb87470ac4f2ae85e663
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci  DEQP_RUNNER_GIT_URL: https://gitlab.freedesktop.org/anholt/deqp-runner.git
1162306a36Sopenharmony_ci  DEQP_RUNNER_GIT_TAG: v0.15.0
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci  FDO_UPSTREAM_REPO: helen.fornazier/linux   # The repo where the git-archive daily runs
1462306a36Sopenharmony_ci  MESA_TEMPLATES_COMMIT: &ci-templates-commit d5aa3941aa03c2f716595116354fb81eb8012acb
1562306a36Sopenharmony_ci  DRM_CI_PROJECT_URL: https://gitlab.freedesktop.org/${DRM_CI_PROJECT_PATH}
1662306a36Sopenharmony_ci  CI_PRE_CLONE_SCRIPT: |-
1762306a36Sopenharmony_ci          set -o xtrace
1862306a36Sopenharmony_ci          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
1962306a36Sopenharmony_ci          bash download-git-cache.sh
2062306a36Sopenharmony_ci          rm download-git-cache.sh
2162306a36Sopenharmony_ci          set +o xtrace
2262306a36Sopenharmony_ci  S3_HOST: s3.freedesktop.org
2362306a36Sopenharmony_ci  # per-pipeline artifact storage on MinIO
2462306a36Sopenharmony_ci  PIPELINE_ARTIFACTS_BASE: ${S3_HOST}/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}
2562306a36Sopenharmony_ci  # per-job artifact storage on MinIO
2662306a36Sopenharmony_ci  JOB_ARTIFACTS_BASE: ${PIPELINE_ARTIFACTS_BASE}/${CI_JOB_ID}
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci  LAVA_JOB_PRIORITY: 30
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cidefault:
3162306a36Sopenharmony_ci  before_script:
3262306a36Sopenharmony_ci    - export SCRIPTS_DIR=$(mktemp -d)
3362306a36Sopenharmony_ci    - 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"
3462306a36Sopenharmony_ci    - source ${SCRIPTS_DIR}/setup-test-env.sh
3562306a36Sopenharmony_ci    - echo -e "\e[0Ksection_start:$(date +%s):unset_env_vars_section[collapsed=true]\r\e[0KUnsetting vulnerable environment variables"
3662306a36Sopenharmony_ci    - export CI_JOB_JWT_FILE="${CI_JOB_JWT_FILE:-$(mktemp)}"
3762306a36Sopenharmony_ci    - echo -n "${CI_JOB_JWT}" > "${CI_JOB_JWT_FILE}"
3862306a36Sopenharmony_ci    - unset CI_JOB_JWT
3962306a36Sopenharmony_ci    - echo -e "\e[0Ksection_end:$(date +%s):unset_env_vars_section\r\e[0K"
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci    - 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"
4262306a36Sopenharmony_ci    - cd $CI_PROJECT_DIR
4362306a36Sopenharmony_ci    - curl --output - $DRM_CI_PROJECT_URL/-/archive/$DRM_CI_COMMIT_SHA/mesa-$DRM_CI_COMMIT_SHA.tar.gz | tar -xz
4462306a36Sopenharmony_ci    - mv mesa-$DRM_CI_COMMIT_SHA/.gitlab-ci* .
4562306a36Sopenharmony_ci    - rm -rf mesa-$DRM_CI_COMMIT_SHA/
4662306a36Sopenharmony_ci    - echo -e "\e[0Ksection_end:$(date +%s):drm_ci_download_section\r\e[0K"
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci  after_script:
4962306a36Sopenharmony_ci    - >
5062306a36Sopenharmony_ci      set +x
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci      test -e "${CI_JOB_JWT_FILE}" &&
5362306a36Sopenharmony_ci      export CI_JOB_JWT="$(<${CI_JOB_JWT_FILE})" &&
5462306a36Sopenharmony_ci      rm "${CI_JOB_JWT_FILE}"
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci  # Retry when job fails.
5762306a36Sopenharmony_ci  retry:
5862306a36Sopenharmony_ci    max: 1
5962306a36Sopenharmony_ci    # Ignore runner_unsupported, stale_schedule, archived_failure, or
6062306a36Sopenharmony_ci    # unmet_prerequisites
6162306a36Sopenharmony_ci    when:
6262306a36Sopenharmony_ci      - api_failure
6362306a36Sopenharmony_ci      - runner_system_failure
6462306a36Sopenharmony_ci      - script_failure
6562306a36Sopenharmony_ci      - job_execution_timeout
6662306a36Sopenharmony_ci      - scheduler_failure
6762306a36Sopenharmony_ci      - data_integrity_failure
6862306a36Sopenharmony_ci      - unknown_failure
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciinclude:
7162306a36Sopenharmony_ci  - project: 'freedesktop/ci-templates'
7262306a36Sopenharmony_ci    ref: 16bc29078de5e0a067ff84a1a199a3760d3b3811
7362306a36Sopenharmony_ci    file:
7462306a36Sopenharmony_ci      - '/templates/ci-fairy.yml'
7562306a36Sopenharmony_ci  - project: 'freedesktop/ci-templates'
7662306a36Sopenharmony_ci    ref: *ci-templates-commit
7762306a36Sopenharmony_ci    file:
7862306a36Sopenharmony_ci      - '/templates/alpine.yml'
7962306a36Sopenharmony_ci      - '/templates/debian.yml'
8062306a36Sopenharmony_ci      - '/templates/fedora.yml'
8162306a36Sopenharmony_ci  - project: *drm-ci-project-path
8262306a36Sopenharmony_ci    ref: *drm-ci-commit-sha
8362306a36Sopenharmony_ci    file:
8462306a36Sopenharmony_ci      - '/.gitlab-ci/farm-rules.yml'
8562306a36Sopenharmony_ci      - '/.gitlab-ci/test-source-dep.yml'
8662306a36Sopenharmony_ci      - '/.gitlab-ci/container/gitlab-ci.yml'
8762306a36Sopenharmony_ci      - '/.gitlab-ci/test/gitlab-ci.yml'
8862306a36Sopenharmony_ci      - '/.gitlab-ci/lava/lava-gitlab-ci.yml'
8962306a36Sopenharmony_ci  - drivers/gpu/drm/ci/image-tags.yml
9062306a36Sopenharmony_ci  - drivers/gpu/drm/ci/container.yml
9162306a36Sopenharmony_ci  - drivers/gpu/drm/ci/static-checks.yml
9262306a36Sopenharmony_ci  - drivers/gpu/drm/ci/build.yml
9362306a36Sopenharmony_ci  - drivers/gpu/drm/ci/test.yml
9462306a36Sopenharmony_ci  - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_cistages:
9862306a36Sopenharmony_ci  - sanity
9962306a36Sopenharmony_ci  - container
10062306a36Sopenharmony_ci  - git-archive
10162306a36Sopenharmony_ci  - build
10262306a36Sopenharmony_ci  - amdgpu
10362306a36Sopenharmony_ci  - i915
10462306a36Sopenharmony_ci  - mediatek
10562306a36Sopenharmony_ci  - meson
10662306a36Sopenharmony_ci  - msm
10762306a36Sopenharmony_ci  - rockchip
10862306a36Sopenharmony_ci  - virtio-gpu
10962306a36Sopenharmony_ci  - lint
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci# YAML anchors for rule conditions
11262306a36Sopenharmony_ci# --------------------------------
11362306a36Sopenharmony_ci.rules-anchors:
11462306a36Sopenharmony_ci  rules:
11562306a36Sopenharmony_ci    # Pipeline for forked project branch
11662306a36Sopenharmony_ci    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
11762306a36Sopenharmony_ci      when: manual
11862306a36Sopenharmony_ci    # Forked project branch / pre-merge pipeline not for Marge bot
11962306a36Sopenharmony_ci    - 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")'
12062306a36Sopenharmony_ci      when: manual
12162306a36Sopenharmony_ci    # Pipeline runs for the main branch of the upstream Mesa project
12262306a36Sopenharmony_ci    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
12362306a36Sopenharmony_ci      when: always
12462306a36Sopenharmony_ci    # Post-merge pipeline
12562306a36Sopenharmony_ci    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
12662306a36Sopenharmony_ci      when: on_success
12762306a36Sopenharmony_ci    # Post-merge pipeline, not for Marge Bot
12862306a36Sopenharmony_ci    - if: &is-post-merge-not-for-marge '$CI_PROJECT_NAMESPACE == "mesa" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_COMMIT_BRANCH'
12962306a36Sopenharmony_ci      when: on_success
13062306a36Sopenharmony_ci    # Pre-merge pipeline
13162306a36Sopenharmony_ci    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
13262306a36Sopenharmony_ci      when: on_success
13362306a36Sopenharmony_ci    # Pre-merge pipeline for Marge Bot
13462306a36Sopenharmony_ci    - if: &is-pre-merge-for-marge '$GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"'
13562306a36Sopenharmony_ci      when: on_success
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci# Rule to filter for only scheduled pipelines.
13862306a36Sopenharmony_ci.scheduled_pipeline-rules:
13962306a36Sopenharmony_ci  rules:
14062306a36Sopenharmony_ci    - if: &is-scheduled-pipeline '$CI_PIPELINE_SOURCE == "schedule"'
14162306a36Sopenharmony_ci      when: on_success
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci# Generic rule to not run the job during scheduled pipelines. Jobs that aren't
14462306a36Sopenharmony_ci# something like a nightly run should include this rule.
14562306a36Sopenharmony_ci.no_scheduled_pipelines-rules:
14662306a36Sopenharmony_ci  rules:
14762306a36Sopenharmony_ci    - if: *is-scheduled-pipeline
14862306a36Sopenharmony_ci      when: never
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci# When to automatically run the CI for build jobs
15162306a36Sopenharmony_ci.build-rules:
15262306a36Sopenharmony_ci  rules:
15362306a36Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
15462306a36Sopenharmony_ci    # Run automatically once all dependency jobs have passed
15562306a36Sopenharmony_ci    - when: on_success
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci.ci-deqp-artifacts:
15962306a36Sopenharmony_ci  artifacts:
16062306a36Sopenharmony_ci    name: "mesa_${CI_JOB_NAME}"
16162306a36Sopenharmony_ci    when: always
16262306a36Sopenharmony_ci    untracked: false
16362306a36Sopenharmony_ci    paths:
16462306a36Sopenharmony_ci      # Watch out!  Artifacts are relative to the build dir.
16562306a36Sopenharmony_ci      # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
16662306a36Sopenharmony_ci      - artifacts
16762306a36Sopenharmony_ci      - _build/meson-logs/*.txt
16862306a36Sopenharmony_ci      - _build/meson-logs/strace
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci.container-rules:
17262306a36Sopenharmony_ci  rules:
17362306a36Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
17462306a36Sopenharmony_ci    # Run pipeline by default in the main project if any CI pipeline
17562306a36Sopenharmony_ci    # configuration files were changed, to ensure docker images are up to date
17662306a36Sopenharmony_ci    - if: *is-post-merge
17762306a36Sopenharmony_ci      changes:
17862306a36Sopenharmony_ci      - drivers/gpu/drm/ci/**/*
17962306a36Sopenharmony_ci      when: on_success
18062306a36Sopenharmony_ci    # Run pipeline by default if it was triggered by Marge Bot, is for a
18162306a36Sopenharmony_ci    # merge request, and any files affecting the pipeline were changed
18262306a36Sopenharmony_ci    - if: *is-pre-merge-for-marge
18362306a36Sopenharmony_ci      when: on_success
18462306a36Sopenharmony_ci    # Run pipeline by default in the main project if it was not triggered by
18562306a36Sopenharmony_ci    # Marge Bot, and any files affecting the pipeline were changed
18662306a36Sopenharmony_ci    - if: *is-post-merge-not-for-marge
18762306a36Sopenharmony_ci      when: on_success
18862306a36Sopenharmony_ci    # Allow triggering jobs manually in other cases
18962306a36Sopenharmony_ci    - when: manual
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci# Git archive
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_cimake git archive:
19662306a36Sopenharmony_ci  extends:
19762306a36Sopenharmony_ci    - .fdo.ci-fairy
19862306a36Sopenharmony_ci  stage: git-archive
19962306a36Sopenharmony_ci  rules:
20062306a36Sopenharmony_ci    - !reference [.scheduled_pipeline-rules, rules]
20162306a36Sopenharmony_ci  # ensure we are running on packet
20262306a36Sopenharmony_ci  tags:
20362306a36Sopenharmony_ci    - packet.net
20462306a36Sopenharmony_ci  script:
20562306a36Sopenharmony_ci    # Remove drm-ci files we just added
20662306a36Sopenharmony_ci    - rm -rf .gitlab-ci.*
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci    # Compactify the .git directory
20962306a36Sopenharmony_ci    - git gc --aggressive
21062306a36Sopenharmony_ci    # compress the current folder
21162306a36Sopenharmony_ci    - tar -cvzf ../$CI_PROJECT_NAME.tar.gz .
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci    # login with the JWT token file
21462306a36Sopenharmony_ci    - 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
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci# Sanity checks of MR settings and commit logs
21862306a36Sopenharmony_cisanity:
21962306a36Sopenharmony_ci  extends:
22062306a36Sopenharmony_ci    - .fdo.ci-fairy
22162306a36Sopenharmony_ci  stage: sanity
22262306a36Sopenharmony_ci  rules:
22362306a36Sopenharmony_ci    - if: *is-pre-merge
22462306a36Sopenharmony_ci      when: on_success
22562306a36Sopenharmony_ci    # Other cases default to never
22662306a36Sopenharmony_ci  variables:
22762306a36Sopenharmony_ci    GIT_STRATEGY: none
22862306a36Sopenharmony_ci  script:
22962306a36Sopenharmony_ci    # ci-fairy check-commits --junit-xml=check-commits.xml
23062306a36Sopenharmony_ci    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
23162306a36Sopenharmony_ci  artifacts:
23262306a36Sopenharmony_ci    when: on_failure
23362306a36Sopenharmony_ci    reports:
23462306a36Sopenharmony_ci      junit: check-*.xml
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci# Rules for tests that should not block merging, but should be available to
23762306a36Sopenharmony_ci# optionally run with the "play" button in the UI in pre-merge non-marge
23862306a36Sopenharmony_ci# pipelines.  This should appear in "extends:" after any includes of
23962306a36Sopenharmony_ci# test-source-dep.yml rules, so that these rules replace those.
24062306a36Sopenharmony_ci.test-manual-mr:
24162306a36Sopenharmony_ci  rules:
24262306a36Sopenharmony_ci    - !reference [.no_scheduled_pipelines-rules, rules]
24362306a36Sopenharmony_ci    - if: *is-forked-branch-or-pre-merge-not-for-marge
24462306a36Sopenharmony_ci      when: manual
24562306a36Sopenharmony_ci  variables:
24662306a36Sopenharmony_ci    JOB_TIMEOUT: 80
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci# Jobs that need to pass before spending hardware resources on further testing
25062306a36Sopenharmony_ci.required-for-hardware-jobs:
25162306a36Sopenharmony_ci  needs: []