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