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