Imported Upstream version 0.1.17
[platform/upstream/libnice.git] / .gitlab-ci.yml
1 stages:
2  - build
3  - test
4  - deploy
5
6 build autotools:
7  stage: build
8  image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
9  except:
10   - schedules
11  script:
12   - ifconfig
13   - export BUILD_ID="libnice-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
14   - export PREFIX="$(pwd)/prefix-$BUILD_ID"
15   - export MAKEFLAGS="-j4"
16   - mkdir "$PREFIX"
17   - ./autogen.sh --prefix="$PREFIX" --enable-compile-warnings=error --enable-gtk-doc --enable-introspection
18   - make
19   - make install
20  artifacts:
21    untracked: true
22
23 test autotools:
24   stage: test
25   image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
26   except:
27     - schedules
28   needs:
29     - build autotools
30   script:
31     - ifconfig
32     - make check
33   artifacts:
34     when: always
35     paths:
36       - config.log
37       - nice/test-suite.log
38       - random/test-suite.log
39       - tests/test-suite.log
40       - stun/tests/test-suite.log
41       - docs/reference/libnice/test-suite.log
42
43 test autotools valgrind:
44   extends: test autotools
45   script:
46     - ifconfig
47     - make check-valgrind
48
49 distcheck autotools:
50   stage: test
51   image: registry.freedesktop.org/libnice/libnice/centos7/autotools-build
52   except:
53     - schedules
54   needs:
55     - build autotools
56   script:
57     - ifconfig
58     - make distcheck
59   artifacts:
60     paths:
61       - libnice-*.tar.gz
62
63 build meson:
64   stage: build
65   image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
66   variables:
67     PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
68   except:
69     - schedules
70   before_script:
71     - mkdir -p "${CI_PROJECT_DIR}"
72   script:
73     ## && true to make gitlab-ci happy
74     - source scl_source enable rh-python36 && true
75     - meson --werror --warnlevel 2 -Dgtk_doc=enabled --prefix=$PREFIX build/
76     - ninja-build -C build/
77   artifacts:
78     paths:
79       - build/
80
81 build msys2:
82   image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v10'
83   stage: 'build'
84   allow_failure: true
85   tags:
86     - 'docker'
87     - 'windows'
88     - '1809'
89   variables:
90     MESON_ARGS: >
91       --prefix=${CI_PROJECT_DIR}/libnice-prefix
92     # Make sure any failure in PowerShell scripts is fatal
93     ErrorActionPreference: 'Stop'
94     WarningPreference: 'Stop'
95   before_script:
96     - pip3 install -U meson
97   script:
98     # Make sure powershell exists on errors
99     # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-6
100     - $ErrorActionPreference = "Stop"
101
102     # For some reason docker build hangs if this is included in the image, needs more troubleshooting
103     - $env:PATH += ';C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin'
104     - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
105     - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm"
106     - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"
107
108     # For some reason, options are separated by newline instead of space, so we
109     # have to replace them first.
110     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
111
112     - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin"
113
114     # For some reason, options are separated by newline instead of space, so we
115     # have to replace them first.
116     - $env:CI_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\','/')
117     - $env:MESON_ARGS = $env:MESON_ARGS.replace('\','/')
118
119     # Build and run the tests.
120     # This is part of the same job due to a bug in the gitlab-runner
121     # that prevents us from exporting artifacts with docker-windows
122     # executors. It has since been fixed in gitlab 12.1, but
123     # we are blocked from upgrading currently.
124     #
125     # Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
126     # Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
127     - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS &&
128         ninja -C build &&
129         meson test -C build --print-errorlogs --suite libnice"
130   artifacts:
131     when: on_failure
132     paths:
133       - build/meson-logs/
134       - build/build.ninja
135
136 .build msvc:
137   extends: build msys2
138   allow_failure: false
139   variables:
140     GLIB_VERSION: 2.64.2
141   script:
142     # For some reason, options are separated by newline instead of space, so we
143     # have to replace them first.
144     - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ")
145
146     # Build and run the tests.
147     # This is part of the same job due to a bug in the gitlab-runner
148     # that prevents us from exporting artifacts with docker-windows
149     # executors. It has since been fixed in gitlab 12.1, but
150     # we are blocked from upgrading currently.
151     #
152     # Gitlab Runner issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4291
153     # Blocked upgrade issue: https://gitlab.freedesktop.org/gstreamer/gst-ci/issues/6#note_192780
154     - 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"
155     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
156         meson subprojects download &&
157         meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\libffi.wrap &&
158         meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\zlib.wrap &&
159         meson wrap promote subprojects\glib-$env:GLIB_VERSION\subprojects\proxy-libintl.wrap &&
160         meson subprojects download"
161     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH &&
162         meson build $env:MESON_ARGS &&
163         ninja -C build &&
164         meson test -C build --print-errorlogs --suite libnice"
165
166 build msvc amd64:
167   extends: .build msvc
168   variables:
169     ARCH: 'amd64'
170
171 build msvc x86:
172   extends: .build msvc
173   variables:
174     ARCH: 'x86'
175         
176 test meson:
177   stage: test
178   image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
179   needs:
180     - build meson
181   except:
182     - schedules
183   script:
184     - ifconfig
185     - source scl_source enable rh-python36 && true
186     - meson test -C build/ --setup debug
187   artifacts:
188     when: on_failure
189     paths:
190       - build/meson-logs/
191
192
193 test valgrind meson:
194   extends: test meson
195   script:
196     - ifconfig
197     - source scl_source enable rh-python36 && true
198     - meson configure build -Dgtk_doc=disabled
199     - meson test -C build/ --setup valgrind --print-errorlogs
200
201
202 doc-and-install meson:
203   stage: test
204   image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
205   needs:
206     - build meson
207   except:
208     - schedules
209   variables:
210     PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
211   script:
212     - source scl_source enable rh-python36 && true
213     - ninja-build -C build/ libnice-doc
214     - ninja-build -C build/ install
215     - ls -lR ${PREFIX}
216   artifacts:
217     paths:
218       - build/docs/reference/libnice/html/
219
220 submit-to-coverity:
221  stage: test
222  image: registry.freedesktop.org/libnice/libnice/centos7/meson-build
223  variables:
224    COVERITY_PROJECT: libnice
225    PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
226  only:
227   - schedules
228   - web
229  dependencies: []
230  before_script:
231   - mkdir -p "${CI_PROJECT_DIR}"
232  script:
233   - 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
234   - mv cov-analysis-linux64-* cov-analysis-linux64
235   - source scl_source enable rh-python36 && true
236   - meson --werror --warnlevel 2 -Dgtk_doc=disabled -Dinstrospection=disabled --prefix=$PREFIX cov-build/
237   - export PATH="$PATH:${CI_PROJECT_DIR}/cov-analysis-linux64/bin"
238   - echo $PATH
239   - cov-build --dir cov-int ninja-build -C cov-build
240   - tar czvf libnice.tgz cov-int
241   - 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
242
243
244 documentation:
245   stage: deploy
246   dependencies:
247     - doc-and-install meson
248   only:
249     - latest-release
250   artifacts:
251     paths:
252       - public
253     expire_in: 1 year
254 #  Needs gitlab 12.8, we're on 12.7 now
255 #  trigger: libnice/libnice-
256   script:
257     - mkdir public/
258     - mv build/docs/reference/libnice/html/ public/libnice/