summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 9aefae44b05a9b24d13f3e5552da1dde6b0c1963 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
image: fedora:rawhide

stages:
  - build

before_script:
  - dnf -y upgrade --disablerepo=rawhide-modular --nogpgcheck fedora-repos fedora-repos-rawhide
  - dnf -y upgrade --disablerepo=rawhide-modular
  - dnf -y install --disablerepo=rawhide-modular --allowerasing --skip-broken @buildsys-build autoconf automake libtool gettext gettext-devel gperf expat-devel libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf bubblewrap
  - dnf -y install --disablerepo=rawhide-modular --allowerasing --skip-broken ninja-build wget python3-pip
  - pip install meson

shared-build:
  stage: build
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - export MAKEFLAGS="-j4"
    - mkdir "$BUILDDIR" "$PREFIX"
    - cd "$BUILDDIR"
    - ../autogen.sh --prefix="$PREFIX" --enable-shared --disable-static --enable-libxml2
    - make
    - make check
    - make install
    - make distcheck
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/fontconfig-*.tar.*
      - build-*/fontconfig*/_build/sub/*.log
      - build-*/fontconfig*/_build/sub/test/*.log
      - build-*/fontconfig*/_build/sub/test/*.trs
      - build-*/fontconfig*/_build/sub/test/out*
      - build-*/*.log
      - build-*/test/*.log
      - build-*/test/*.trs
      - build-*/test/out*
      - prefix-*
static-build:
  stage: build
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - export MAKEFLAGS="-j4"
    - mkdir "$BUILDDIR"
    - cd "$BUILDDIR"
    - ../autogen.sh --prefix="$PREFIX" --disable-shared --enable-static --enable-libxml2
    - make
    - make check
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/*.log
      - build-*/test/*.log
      - build-*/test/*.trs
      - build-*/test/out*
mingw-build:
  image: fedora:35
  stage: build
  before_script:
    - dnf -y upgrade --disablerepo=rawhide-modular
    - dnf -y install --disablerepo=rawhide-modular --allowerasing --skip-broken @buildsys-build autoconf automake libtool gettext gettext-devel gperf libxml2-devel freetype-devel json-c-devel git docbook-utils docbook-utils-pdf wget
    - dnf -y install --disablerepo=rawhide-modular --allowerasing --skip-broken mingw64-gettext mingw64-freetype mingw64-libxml2 wine
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - export MAKEFLAGS="-j4"
    - mkdir "$BUILDDIR"
    - cd "$BUILDDIR"
    - eval `rpm --eval %{mingw64_env}`
    - ../autogen.sh --prefix="$PREFIX" --host=x86_64-mingw32 --disable-shared --enable-static --enable-libxml2
    - make
    - make check
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/*.log
      - build-*/test/*.log
      - build-*/test/*.trs
      - build-*/test/out*
meson-shared-build:
  image: fedora:latest
  stage: build
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - export MAKEFLAGS="-j4"
    - meson --prefix="$PREFIX" --default-library=shared "$BUILDDIR"
    - ninja -C "$BUILDDIR"
    - ninja -C "$BUILDDIR" test
    - ninja -C "$BUILDDIR" install
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/meson-logs/*txt
      - prefix-*
meson-static-build:
  image: fedora:latest
  stage: build
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - export MAKEFLAGS="-j4"
    - meson --prefix="$PREFIX" --default-library=static "$BUILDDIR"
    - ninja -C "$BUILDDIR"
    - ninja -C "$BUILDDIR" test
    - ninja -C "$BUILDDIR" install
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/meson-logs/*txt
      - prefix-*
meson-mingw-w64-build:
  image: fedora:latest
  stage: build
  # allow failure until https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/263 is resolved
  allow_failure: true
  script:
    - export BUILD_ID="fontconfig-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
    - export PREFIX="$(pwd)/prefix-$BUILD_ID"
    - export BUILDDIR="$(pwd)/build-$BUILD_ID"
    - eval `rpm --eval %{mingw64_env}`
    - meson --prefix="$PREFIX" "$BUILDDIR" --cross-file .gitlab-ci/linux-mingw-w64-64bit.txt
    - ninja -C "$BUILDDIR"
    - ninja -C "$BUILDDIR" test
    # install doesn't work, fccache problems, but autotools ci doesn't do that either
    # - ninja -C "$BUILDDIR" install
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/meson-logs/*txt
      - prefix-*

# FIXME: fontconfig should probably get its own image
# In the meantime, the latest GStreamer image tag can be found here:
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/.gitlab-image-tags.yml#L10
.build meson windows:
  image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2022-09-23.0-main'
  stage: 'build'
  tags:
    - 'docker'
    - 'windows'
    - '2022'
  variables:
    # Make sure any failure in PowerShell scripts is fatal
    ErrorActionPreference: 'Stop'
    WarningPreference: 'Stop'
    # Uncomment the following key if need to pass custom args, as well with the
    # $env:MESON_ARGS line in the `script:` blocks
    # MESON_ARGS: >-
    #   -Dfoo=enabled
    #   -Dbar=disabled
  before_script:
    # Make sure meson is up to date, so we don't need to rebuild the image with each release
    - pip3 install -U meson certifi
  script:
    # For some reason, options are separated by newline instead of space, so we
    # have to replace them first.
    # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
    # Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script.
    # Environment variables substitutions is done by PowerShell before calling
    # cmd.exe, that's why we use $env:FOO instead of %FOO%
    - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
        SET CERT_PATH=$(python -m certifi) &&
        SET SSL_CERT_FILE=$(python -m certifi) &&
        SET REQUESTS_CA_BUNDLE=$(python -m certifi) &&
        meson build $env:MESON_ARGS &&
        ninja -C build &&
        ninja -C build test"
  artifacts:
    name: fontconfig-$CI_COMMIT_SHA-$CI_JOB_ID
    when: always
    paths:
      - build-*/meson-logs/*txt
      - prefix-*

meson vs2019 amd64:
  extends: '.build meson windows'
  variables:
    ARCH: 'amd64'

meson vs2019 x86:
  extends: '.build meson windows'
  variables:
    ARCH: 'x86'

meson macos:
  stage: 'build'
  tags:
    - gst-macos-11.1
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "build/meson-logs/*txt"
  before_script:
    - pip3 install --upgrade pip
    # Make sure meson is up to date
    - pip3 install -U meson
    # Need to install certificates for python
    - pip3 install --upgrade certifi
    # Anther way t install certificates
    - open /Applications/Python\ 3.8/Install\ Certificates.command
    # Get ninja
    - curl -L -o ninja-mac.zip https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-mac.zip
    - unzip ninja-mac.zip
    - sudo cp ninja /usr/local/bin
  script:
    - CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH} && meson build
    - ninja -C build
    - ninja -C build test

# msys infrastructure is a bit broken, disable for now
meson msys2:
  extends: '.build meson windows'
  when: 'manual'
  allow_failure: true
  script:
    # For some reason, options are separated by newline instead of space, so we
    # have to replace them first.
    # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")

    - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin"
    # XXX: Copied from https://gitlab.freedesktop.org/gstreamer/gst-ci/blob/master/gitlab/ci_template.yml#L487
    # For some reason docker build hangs if this is included in the image, needs more troubleshooting
    - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
    - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm"
    - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
    - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS &&
        ninja -C build &&
        ninja -C build test"

meson android arm64 fedora:
  # See https://gitlab.freedesktop.org/gstreamer/gst-ci/container_registry/164 for current images
  image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/android-fedora:2020-10-22.0-master'
  stage: 'build'
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "build/meson-logs/*.txt"
  before_script:
    - dnf install -y python3-pip gcc ninja-build gperf
    - pip3 install --user meson
  script:
    - export PATH="$HOME/.local/bin:$PATH"
    - |
      cat > android-cross-file.txt <<EOF
      [constants]
      ndk_path    = '/android/ndk'
      toolchain   = ndk_path + '/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android'
      api         = '28'

      [host_machine]
      system      = 'android'
      cpu_family  = 'aarch64'
      cpu         = 'aarch64'
      endian      = 'little'

      [properties]
      sys_root        = ndk_path + '/sysroot'
      c_args          = ['-Wno-pointer-bool-conversion']
      c_link_args     = ['-fuse-ld=gold']
      cpp_link_args   = ['-fuse-ld=gold']

      [binaries]
      c           = toolchain + api + '-clang'
      cpp         = toolchain + api + '-clang++'
      ar          = toolchain + '-ar'
      strip       = toolchain + '-strip'
      EOF
    - meson setup --werror --cross-file android-cross-file.txt build
    - meson compile --verbose -C build