summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: d72afd557bfe1051f2aa5b7590c833f9b94f11f5 (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
stages:
 - build
 - test
 - deploy

build autotools:
 stage: build
 image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
 except:
  - schedules
 script:
  - ifconfig
  - export BUILD_ID="libnice-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
  - export PREFIX="$(pwd)/prefix-$BUILD_ID"
  - export MAKEFLAGS="-j4"
  - mkdir "$PREFIX"
  - ./autogen.sh --prefix="$PREFIX" --enable-compile-warnings=error --enable-gtk-doc --enable-introspection
  - make
  - make install
 artifacts:
   untracked: true

test autotools:
  stage: test
  image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
  except:
    - schedules
  needs:
    - build autotools
  script:
    - ifconfig
    - make check
  artifacts:
    when: always
    paths:
      - config.log
      - nice/test-suite.log
      - random/test-suite.log
      - tests/test-suite.log
      - stun/tests/test-suite.log
      - docs/reference/libnice/test-suite.log

test autotools valgrind:
  extends: test autotools
  script:
    - ifconfig
    - make check-valgrind

distcheck autotools:
  stage: test
  image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
  except:
    - schedules
  needs:
    - build autotools
  script:
    - ifconfig
    - make distcheck
  artifacts:
    paths:
      - libnice-*.tar.gz

build meson:
  stage: build
  image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
  variables:
    PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
  except:
    - schedules
  before_script:
    - mkdir -p "${CI_PROJECT_DIR}"
  script:
    ## && true to make gitlab-ci happy
    - source scl_source enable rh-python36 && true
    - meson --werror --warnlevel 2 -Dgtk_doc=enabled --prefix=$PREFIX build/
    - ninja-build -C build/
  artifacts:
    paths:
      - build/

build msys2:
  image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v10'
  stage: 'build'
  allow_failure: true
  tags:
    - 'docker'
    - 'windows'
    - '1809'
  variables:
    MESON_ARGS: >
      --prefix=${CI_PROJECT_DIR}/libnice-prefix
    # Make sure any failure in PowerShell scripts is fatal
    ErrorActionPreference: 'Stop'
    WarningPreference: 'Stop'
  before_script:
    - pip3 install -U meson
  script:
    # Make sure powershell exists on errors
    # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
    - $ErrorActionPreference = "Stop"

    # For some reason docker build hangs if this is included in the image, needs more troubleshooting
    - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
    - 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"

    # 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"

    # For some reason, options are separated by newline instead of space, so we
    # have to replace them first.
    - $env:CI_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
    - $env:MESON_ARGS = $env:MESON_ARGS.replace('\','/')

    # Build and run the tests.
    # This is part of the same job due to a bug in the gitlab-runner
    # that prevents us from exporting artifacts with docker-windows
    # executors. It has since been fixed in gitlab 12.1, but
    # we are blocked from upgrading currently.
    #
    # Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
    # Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
    - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS &&
        ninja -C build &&
        meson test -C build --print-errorlogs --suite libnice"
  artifacts:
    when: on_failure
    paths:
      - build/meson-logs/
      - build/build.ninja

.build msvc:
  extends: build msys2
  allow_failure: false
  variables:
    GLIB_VERSION: 2.64.2
  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"," ")

    # Build and run the tests.
    # This is part of the same job due to a bug in the gitlab-runner
    # that prevents us from exporting artifacts with docker-windows
    # executors. It has since been fixed in gitlab 12.1, but
    # we are blocked from upgrading currently.
    #
    # Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
    # Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
    - New-Item -Path subprojects -Name openssl.wrap -Value "[wrap-git]`r`ndirectory=openssl`r`nurl=https://gitlab.freedesktop.org/libnice/openssl-binaries-for-ci.git`r`nrevision=1.1.1c`r`n"
    - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
        meson subprojects download &&
        meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\libffi.wrap &&
        meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\zlib.wrap &&
        meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\proxy-libintl.wrap &&
        meson subprojects download"
    - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
        meson build $env:MESON_ARGS &&
        ninja -C build &&
        meson test -C build --print-errorlogs --suite libnice"

build msvc amd64:
  extends: .build msvc
  variables:
    ARCH: 'amd64'

build msvc x86:
  extends: .build msvc
  variables:
    ARCH: 'x86'
        
test meson:
  stage: test
  image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
  needs:
    - build meson
  except:
    - schedules
  script:
    - ifconfig
    - source scl_source enable rh-python36 && true
    - meson test -C build/ --setup debug
  artifacts:
    when: on_failure
    paths:
      - build/meson-logs/


test valgrind meson:
  extends: test meson
  script:
    - ifconfig
    - source scl_source enable rh-python36 && true
    - meson configure build -Dgtk_doc=disabled
    - meson test -C build/ --setup valgrind --print-errorlogs


doc-and-install meson:
  stage: test
  image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
  needs:
    - build meson
  except:
    - schedules
  variables:
    PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
  script:
    - source scl_source enable rh-python36 && true
    - ninja-build -C build/ libnice-doc
    - ninja-build -C build/ install
    - ls -lR ${PREFIX}
  artifacts:
    paths:
      - build/docs/reference/libnice/html/

submit-to-coverity:
 stage: test
 image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
 variables:
   COVERITY_PROJECT: libnice
   PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
 only:
  - schedules
  - web
 dependencies: []
 before_script:
  - mkdir -p "${CI_PROJECT_DIR}"
 script:
  - curl -v https://scan.coverity.com/download/linux64  -o coverity_tool.tgz  --form token="${COVERITY_TOKEN}" --form project="${COVERITY_PROJECT}" && tar xf coverity_tool.tgz && rm coverity_tool.tgz
  - mv cov-analysis-linux64-* cov-analysis-linux64
  - source scl_source enable rh-python36 && true
  - meson --werror --warnlevel 2 -Dgtk_doc=disabled -Dinstrospection=disabled --prefix=$PREFIX cov-build/
  - export PATH="$PATH:${CI_PROJECT_DIR}/cov-analysis-linux64/bin"
  - echo $PATH
  - cov-build --dir cov-int ninja-build -C cov-build
  - tar czvf libnice.tgz cov-int
  - curl --form token=$COVERITY_TOKEN --form email=olivier.crete@ocrete.ca --form file=@libnice.tgz --form version="${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}" --form description="CI weekly run" https://scan.coverity.com/builds?project=libnice


documentation:
  stage: deploy
  dependencies:
    - doc-and-install meson
  only:
    - latest-release
  artifacts:
    paths:
      - public
    expire_in: 1 year
#  Needs gitlab 12.8, we're on 12.7 now
#  trigger: libnice/libnice-
  script:
    - mkdir public/
    - mv build/docs/reference/libnice/html/ public/libnice/