summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: c6044ab8938d63142b3d956c5ea862e07daa022c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
variables:
  FDO_UPSTREAM_REPO: mesa/shader-db
  MESA_TEMPLATES_COMMIT: &ci-templates-commit ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2

default:
  # Retry build or test jobs up to twice when the gitlab-runner itself fails somehow.
  retry:
    max: 2
    when:
      - runner_system_failure

include:
  - project: 'freedesktop/ci-templates'
    ref: *ci-templates-commit
    file:
      - '/templates/ci-fairy.yml'
      - '/templates/debian.yml'


# YAML anchors for rule conditions
# --------------------------------
.rules-anchors:
  rules:
    # Pipeline for forked project branch
    - if: &is-forked-branch '$CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE != "mesa"'
      when: manual
    # Forked project branch / pre-merge pipeline
    - if: &is-forked-branch-or-pre-merge '$CI_PROJECT_NAMESPACE != "mesa" || $CI_PIPELINE_SOURCE == "merge_request_event"'
      when: manual
    # Pipeline runs for the main branch of the upstream Mesa project
    - if: &is-mesa-main '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_COMMIT_BRANCH'
      when: always
    # Post-merge pipeline
    - if: &is-post-merge '$CI_PROJECT_NAMESPACE == "mesa" && $CI_COMMIT_BRANCH'
      when: on_success
    # Pre-merge pipeline
    - if: &is-pre-merge '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: on_success


# Sanity checks of MR settings and commit logs
sanity:
  extends:
    - .fdo.ci-fairy
  stage: .pre
  rules:
    - if: *is-pre-merge
      when: on_success
    # Other cases default to never
  variables:
    GIT_STRATEGY: none
  script:
    # ci-fairy check-commits --junit-xml=check-commits.xml
    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-merge-request.xml
  artifacts:
    when: on_failure
    reports:
      junit: check-*.xml


.debian-container:
  variables:
    FDO_DISTRIBUTION_VERSION: bullseye
    FDO_DISTRIBUTION_TAG: 2023-02-18-initial-ci-rev2

debian:
  extends:
    - .fdo.container-build@debian
    - .debian-container
  rules:
    # Always run after a merge
    - if: *is-post-merge
      when: on_success
    # Run job if it is for a merge request and the CI was modified
    - if: *is-pre-merge
      changes:
        - .gitlab-ci.yml
    # Allow triggering jobs manually in other cases
    - when: manual
  variables:
    # bump FDO_DISTRIBUTION_TAG above when you change the packages below
    FDO_DISTRIBUTION_PACKAGES: >
      bison
      curl
      flex
      g++
      gcc
      git
      libgbm-dev
      libepoxy-dev
      libexpat-dev
      libpciaccess-dev
      make
      ninja-build
      pkg-config
      python3-mako
      python3-pip
      python3-setuptools
      wget
      zlib1g-dev
      zstd


mesa-drivers:
  extends:
    - .fdo.distribution-image@debian
    - .debian-container
  rules:
    # Run pipeline by default if it is for a merge request.
    - if: *is-pre-merge
      when: on_success
    # Allow triggering jobs manually in other cases
    - when: manual
  variables:
    GALLIUM_DRIVERS: >
      freedreno
      iris
      nouveau
      r300
      v3d
      vc4

  before_script:
    - set -eu

    # Meson in the debian repos is too old, so install from pip
    - python3 -m pip install meson

    # Install Mesa
    - echo -e "\e[0Ksection_start:$(date +%s):mesa-install[collapsed=true]\r\e[0KInstalling Mesa's drm-shim drivers"
    - git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git
    - sh mesa/.gitlab-ci/container/build-libdrm.sh
    # `-D tools=intel` is needed until this bug is fixed:
    # https://gitlab.freedesktop.org/mesa/mesa/-/issues/7789
    - meson setup mesa build
      --buildtype debug
      --prefix "$PWD"/install
      --libdir lib
      -D vulkan-drivers=
      -D llvm=disabled
      -D glx=disabled
      -D platforms=
      -D tools=drm-shim,intel
      -D gallium-drivers=$(echo "$GALLIUM_DRIVERS" | sed 's/ /,/g')
    - meson install -C build
    - echo -e "\e[0Ksection_end:$(date +%s):mesa-install\r\e[0K"

    # Mesa script expects shader-db there
    - make
    - mkdir /usr/local/shader-db
    - mv run /usr/local/shader-db
    - mv shaders /usr/local/shader-db
    - mv fossils /usr/local/shader-db

  script:
    - find install -not -type d | sort
    - set +u # setup-test-env.sh references undefined variables
    - . mesa/.gitlab-ci/setup-test-env.sh
    - . mesa/.gitlab-ci/run-shader-db.sh