summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: a7dda4d6040efcba92276fe275f990e6380da3ab (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
287
288
289
290
# The build has two stages. The 'container' stage is used to build a Docker
# container and push it to the project's container registry on fd.o GitLab.
# This step is only run when the tag for the container changes, else it is
# effectively a no-op. All of this infrastructure is inherited from the
# wayland/ci-templates repository which is the recommended way to set up CI
# infrastructure on fd.o GitLab.
#
# Once the container stage is done, we move on to the 'build' stage where we
# run an autotools and meson build in parallel. Currently, tests are also run
# as part of the build stage as there doesn't seem to be significant value to
# splitting the stages at the moment.

stages:
  - container
  - build

variables:
  # Update this tag when you want to trigger a rebuild the container in which
  # CI runs, for example when adding new packages to FDO_DISTRIBUTION_PACKAGES.
  # The tag is an arbitrary string that identifies the exact container
  # contents.
  BASE_TAG: '2023-05-25.0'
  FDO_DISTRIBUTION_VERSION: '22.10'
  FDO_UPSTREAM_REPO: 'pulseaudio/webrtc-audio-processing'

include:
  # We pull templates from master to avoid the overhead of periodically
  # scanning for changes upstream. This does means builds might occasionally
  # break due to upstream changing things, so if you see unexpected build
  # failures, this might be one cause.
  - project: 'freedesktop/ci-templates'
    ref: 'master'
    file: '/templates/ubuntu.yml'

# Common container build template
.ubuntu-container-build:
  variables:
    GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image

    # Remember to update FDO_DISTRIBUTION_TAG when modifying this package list!
    # Otherwise the changes won't have effect since an old container image will
    # be used.
    FDO_DISTRIBUTION_PACKAGES: >-
      g++
      gcc
      git-core
      cmake
      libabsl-dev
      meson
      ninja-build
      pkg-config
      python3-setuptools

# Used to extend both container and build jobs
.ubuntu-x86_64:
  variables:
    FDO_DISTRIBUTION_TAG: "x86_64-$BASE_TAG"

# Used to extend both container and build jobs
.ubuntu-aarch64:
  tags:
    - aarch64
  variables:
    FDO_DISTRIBUTION_TAG: "aarch64-$BASE_TAG"

build-container-x86_64:
  extends:
    - .fdo.container-build@ubuntu@x86_64
    - .ubuntu-container-build
    - .ubuntu-x86_64
  stage: container

build-container-aarch64:
  extends:
    - .fdo.container-build@ubuntu@aarch64
    - .ubuntu-container-build
    - .ubuntu-aarch64
  stage: container

# Common build template
.build-distro-absl:
  stage: build
  extends:
    - .fdo.distribution-image@ubuntu
  script:
    - meson setup --wrap-mode=nofallback --prefix=/usr --libdir=lib builddir
    - ninja -C builddir
    - DESTDIR=$PWD/_install ninja install -C builddir
      # Test that the pc files are usable
    - PKG_CONFIG_PATH=$PWD/_install/usr/lib/pkgconfig pkg-config --cflags --libs webrtc-audio-processing-1
    - PKG_CONFIG_PATH=$PWD/_install/usr/lib/pkgconfig pkg-config --cflags --libs webrtc-audio-coding-1
  artifacts:
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*txt"

.build-vendored-absl:
  stage: build
  extends:
    - .fdo.distribution-image@ubuntu
  script:
    - meson setup --force-fallback-for=abseil-cpp --prefix=/usr --libdir=lib builddir
    - ninja -C builddir
    - DESTDIR=$PWD/_install ninja install -C builddir
      # Test that the pc files are usable
    - PKG_CONFIG_LIBDIR=$PWD/_install/usr/lib/pkgconfig pkg-config --cflags --libs webrtc-audio-processing-1
    - PKG_CONFIG_LIBDIR=$PWD/_install/usr/lib/pkgconfig pkg-config --cflags --libs webrtc-audio-coding-1
  artifacts:
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*txt"

build-distro-absl-x86_64:
  extends:
    - .build-distro-absl
    - .ubuntu-x86_64

build-vendored-absl-x86_64:
  extends:
    - .build-vendored-absl
    - .ubuntu-x86_64

build-distro-absl-aarch64:
  extends:
    - .build-distro-absl
    - .ubuntu-aarch64

build-vendored-absl-aarch64:
  extends:
    - .build-vendored-absl
    - .ubuntu-aarch64

# Update from:
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
vs2019 amd64:
  # Update from https://gitlab.freedesktop.org/gstreamer/gstreamer/container_registry
  image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-04-21.0-main'
  stage: 'build'
  tags:
    - 'docker'
    - 'windows'
    - '2022'
  artifacts:
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*txt"
  variables:
    # Make sure any failure in PowerShell scripts is fatal
    ErrorActionPreference: 'Stop'
    WarningPreference: 'Stop'
    ARCH: 'amd64'
    PLAT: 'Desktop'
  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 ninja
  script:
    # 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 -app_platform=$env:PLAT &&
        meson setup builddir &&
        meson compile --verbose -C builddir"

# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
macos x86_64:
  stage: 'build'
  tags:
    - gst-macos-13
  artifacts:
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*txt"
  before_script:
    - pip3 install --upgrade pip
    # Need to install certificates for python
    - pip3 install --upgrade certifi
    # Anther way to install certificates
    - open /Applications/Python\ 3.8/Install\ Certificates.command
    # Make sure meson and ninja are up to date
    - pip3 install -U meson ninja
  script:
    - CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH}
    - meson setup builddir
    - meson compile --verbose -C builddir

# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
ios arm64:
  stage: 'build'
  tags:
    - gst-ios-16
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*txt"
  before_script:
    - pip3 install --upgrade pip
    # Need to install certificates for python
    - pip3 install --upgrade certifi
    # Anther way to install certificates
    - open /Applications/Python\ 3.8/Install\ Certificates.command
    # Make sure meson and ninja are up to date
    - pip3 install -U meson ninja
  script:
    - CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH}
    - |
      cat > ios-cross-file.txt <<EOF
      [host_machine]
      system = 'darwin'
      cpu_family = 'aarch64'
      cpu = 'aarch64'
      endian = 'little'

      [properties]
      c_args           = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      objc_args        = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      cpp_args         = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      objcpp_args      = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      c_link_args      = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      objc_link_args   = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      cpp_link_args    = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
      objcpp_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']

      [binaries]
      ar        = '$(xcrun --find --sdk iphoneos ar)'
      c         = '$(xcrun --find --sdk iphoneos clang)'
      objc      = '$(xcrun --find --sdk iphoneos clang)'
      cpp       = '$(xcrun --find --sdk iphoneos clang++)'
      objcpp    = '$(xcrun --find --sdk iphoneos clang++)'
      ranlib    = '$(xcrun --find --sdk iphoneos ranlib)'
      strip     = '$(xcrun --find --sdk iphoneos strip)'
      pkgconfig = 'false'
      cmake     = 'false'
      EOF
    - meson setup --cross-file ios-cross-file.txt builddir
    - meson compile --verbose -C builddir

# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
android fedora arm64:
  # Update from https://gitlab.freedesktop.org/gstreamer/cerbero/container_registry
  image: 'registry.freedesktop.org/gstreamer/cerbero/amd64/android-fedora:2021-10-22.0-1.18'
  stage: 'build'
  artifacts:
    expire_in: '5 days'
    when: 'always'
    paths:
      - "builddir/meson-logs/*.txt"
  before_script:
    - dnf install -y python3-pip gcc ninja-build
    - 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_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 --cross-file android-cross-file.txt builddir
    - meson compile --verbose -C builddir