aboutsummaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: a9a854f3702c498b65953d7d1a93b31f27d8b4a5 (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
variables:
  FDO_UPSTREAM_REPO: mesa/waffle
  FDO_DISTRIBUTION_TAG: '2021-07-26'
  FDO_DISTRIBUTION_VERSION: 'buster-slim'

include:
  - project: 'freedesktop/ci-templates'
    ref: &ci-templates-sha 52dd4a94044449c8481d18dcdc221a3c636366d2
    file: '/templates/debian.yml'

stages:
  - container
  - style-check
  - build
  - www

# When to automatically run the CI
.ci-run-policy:
  retry:
    max: 2
    when:
      - runner_system_failure
  # Cancel CI run if a newer commit is pushed to the same branch
  interruptible: true

container:
  stage: container
  extends:
    - .fdo.container-build@debian
    - .ci-run-policy
  variables:
    # no need to pull the whole repo to build the container image
    GIT_STRATEGY: none
   
    # clang-format-7 requires git, yet it's missing in the packaging
    FDO_DISTRIBUTION_PACKAGES: >
      bash-completion
      ca-certificates
      clang-format-7
      cmake
      docbook-xsl
      docbook-xml
      g++
      gcc
      git
      libcmocka-dev
      libdrm-dev
      libegl1-mesa-dev
      libgbm-dev
      libgl1-mesa-dev
      libwayland-dev
      libx11-dev
      libxcb1-dev
      make
      meson
      mingw-w64
      pkg-config
      wayland-protocols
      xauth
      xsltproc
      xvfb

clang-format:
  extends:
    - .ci-run-policy
    - .fdo.container-build@debian
  stage: style-check
  variables:
    GIT_DEPTH: 100
  image: "$CI_REGISTRY_IMAGE/debian/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG"
  needs:
    - container
  script:
    - .gitlab-ci/clang-format.sh

# BUILD
.build:
  extends: 
    - .ci-run-policy
    - .fdo.container-build@debian
  stage: build
  variables:
    GIT_DEPTH: 100
  image: "$CI_REGISTRY_IMAGE/debian/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG"
  needs:
    - container
    

meson:
  extends:
    - .build
  script:
    - bash .gitlab-ci/build-meson.sh x11
    - bash .gitlab-ci/build-meson.sh wayland
    - bash .gitlab-ci/build-meson.sh gbm
    - bash .gitlab-ci/build-meson.sh surfaceless
  artifacts:
    when: on_failure
    paths:
      - _build/meson-logs/*.txt

cmake:
  extends:
    - .build
  script:
    - cmake
        -S . -B _build
        -DCMAKE_INSTALL_PREFIX=`pwd`/install
        -DCMAKE_BUILD_TYPE=Debug
        -Dwaffle_has_gbm=1
        -Dwaffle_has_glx=1
        -Dwaffle_has_x11_egl=1
        -Dwaffle_has_wayland=1
        -Dwaffle_has_surfaceless=1
        -Dwaffle_build_manpages=1
        -Dwaffle_build_htmldocs=1
        -Dwaffle_build_examples=1
    - make -C _build -j4
    - make -C _build check
    - make -C _build install

cmake-mingw:
  extends:
    - .build
  script:
    - .gitlab-ci/build-cmake-mingw.sh
  # TODO: Only create artifacts on certain builds.  See also:
  # - https://docs.gitlab.com/ee/ci/yaml/README.html#artifactspaths
  # - https://docs.gitlab.com/ee/ci/yaml/README.html#complete-example-for-release
  artifacts:
    paths:
      - publish/*/waffle-*.zip

pages:
  stage: www
  image: alpine
  script:
  - apk add --no-cache git git-lfs
  - git lfs install
  - mkdir public
  - git checkout origin/website
  - git log --oneline -1
  - cp -r files man public
  - git checkout origin/master
  - git log --oneline -1
  - cd www
  - cp -r *.jpg *.html *.css ../public
  artifacts:
    paths:
    - public
  only:
    refs:
      - master
# TODO: Trigger pages only when the `www` directory changes. But, with this
# `changes` code, it never triggers the job.
#    changes:
#      - www/**