.gitlab-ci.yml 7.34 KB
Newer Older
Olivier Crête's avatar
Olivier Crête committed
1 2
stages:
 - build
3
 - test
Olivier Crête's avatar
Olivier Crête committed
4
 - deploy
Olivier Crête's avatar
Olivier Crête committed
5

6 7 8 9
default:
  image: registry.freedesktop.org/libnice/libnice/centos7/meson-build


10
build:
Jordan Petridіs's avatar
Jordan Petridіs committed
11 12 13
  stage: build
  variables:
    PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
14 15
  except:
    - schedules
Jordan Petridіs's avatar
Jordan Petridіs committed
16 17 18
  before_script:
    - mkdir -p "${CI_PROJECT_DIR}"
  script:
19 20
    ## && true to make gitlab-ci happy
    - source scl_source enable rh-python36 && true
21
    - meson --werror --warnlevel 2 -Dgtk_doc=enabled --prefix=$PREFIX build/
22
    - ninja-build -C build/
23
  artifacts:
24 25 26
    paths:
      - build/

Jordan Petridіs's avatar
Jordan Petridіs committed
27
build msys2:
28
  image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v13-master'
Jordan Petridіs's avatar
Jordan Petridіs committed
29 30 31 32
  stage: 'build'
  tags:
    - 'docker'
    - 'windows'
33
    - '1809'
Jordan Petridіs's avatar
Jordan Petridіs committed
34 35 36 37 38 39 40
  variables:
    MESON_ARGS: >
      --prefix=${CI_PROJECT_DIR}/libnice-prefix
    # Make sure any failure in PowerShell scripts is fatal
    ErrorActionPreference: 'Stop'
    WarningPreference: 'Stop'
  before_script:
41
    - pip3 install -U meson==0.56.2
Jordan Petridіs's avatar
Jordan Petridіs committed
42
  script:
43 44 45 46 47 48
    # 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'
49
    # It seems that the gpg doesn't like the SSL secured version of the keyserver
50
    - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true"
51 52 53 54
    - echo "Download newest msys2 keyring"
    - 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"
    - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2"
    - C:\msys64\usr\bin\bash -c "pacman-key --refresh-keys || true"
55 56 57 58 59 60 61
    - echo "Updating MSYS2"
    - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm || echo Update failed, ignoring"
    - echo "Killing all MSYS2 processes"
    - taskkill /F /FI "MODULES eq msys-2.0.dll"
    - echo "Completing MSYS2 update"
    - C:\msys64\usr\bin\bash -c "pacman -Suu --noconfirm"
    - echo "Installing needed MSYS2 packages"
62 63
    - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja"

Jordan Petridіs's avatar
Jordan Petridіs committed
64 65 66 67 68
    # 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"
69 70 71 72 73 74

    # 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('\','/')

Jordan Petridіs's avatar
Jordan Petridіs committed
75 76 77 78 79 80 81 82 83
    # 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 &&
84
        ninja -j 1 -C build &&
Jordan Petridіs's avatar
Jordan Petridіs committed
85
        meson test -C build --print-errorlogs --suite libnice"
86 87 88 89 90
  artifacts:
    when: on_failure
    paths:
      - build/meson-logs/
      - build/build.ninja
Jordan Petridіs's avatar
Jordan Petridіs committed
91

Olivier Crête's avatar
Olivier Crête committed
92 93
.build msvc:
  extends: build msys2
94 95
  variables:
    GLIB_VERSION: 2.64.2
Olivier Crête's avatar
Olivier Crête committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
  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 &&
112 113 114
        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 &&
Olivier Crête's avatar
Olivier Crête committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
        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'
        
131
test:
132
  stage: test
133
  needs:
134
    - build
135 136 137 138
  except:
    - schedules
  script:
    - ifconfig
139
    - source scl_source enable rh-python36 && true
140
    - meson test -C build/ --setup debug
141 142
  artifacts:
    when: on_failure
143 144
    paths:
      - build/meson-logs/
Jordan Petridіs's avatar
Jordan Petridіs committed
145

146

147 148
test valgrind:
  extends: test
149 150 151
  script:
    - ifconfig
    - source scl_source enable rh-python36 && true
152
    - meson configure build -Dgtk_doc=disabled
153 154 155
    - meson test -C build/ --setup valgrind --print-errorlogs


156
doc-and-install:
157
  stage: test
158
  needs:
159
    - build
160 161 162 163 164
  except:
    - schedules
  variables:
    PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
  script:
165 166 167
    - source scl_source enable rh-python36 && true
    - ninja-build -C build/ libnice-doc
    - ninja-build -C build/ install
168 169 170 171 172
    - ls -lR ${PREFIX}
  artifacts:
    paths:
      - build/docs/reference/libnice/html/

Olivier Crête's avatar
Olivier Crête committed
173
submit-to-coverity:
174 175 176
 stage: test
 variables:
   COVERITY_PROJECT: libnice
177
   PREFIX: "${CI_PROJECT_DIR}/libnice-prefix"
Olivier Crête's avatar
Olivier Crête committed
178 179
 only:
  - schedules
180
  - web
181
 dependencies: []
182 183
 before_script:
  - mkdir -p "${CI_PROJECT_DIR}"
Olivier Crête's avatar
Olivier Crête committed
184
 script:
185
  - 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
186
  - mv cov-analysis-linux64-* cov-analysis-linux64
187 188
  - source scl_source enable rh-python36 && true
  - meson --werror --warnlevel 2 -Dgtk_doc=disabled -Dinstrospection=disabled --prefix=$PREFIX cov-build/
189 190
  - export PATH="$PATH:${CI_PROJECT_DIR}/cov-analysis-linux64/bin"
  - echo $PATH
191
  - cov-build --dir cov-int ninja-build -C cov-build
Olivier Crête's avatar
Olivier Crête committed
192 193
  - 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
Olivier Crête's avatar
Olivier Crête committed
194

Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
195
pages:
Olivier Crête's avatar
Olivier Crête committed
196
  stage: deploy
197
  dependencies:
198
    - doc-and-install
Olivier Crête's avatar
Olivier Crête committed
199
  only:
200
    - latest-release
Olivier Crête's avatar
Olivier Crête committed
201 202 203
  artifacts:
    paths:
      - public
204
    expire_in: 1 year
205 206
  # For some reason, trigger gets rejected
  # trigger: libnice/libnice-website
Olivier Crête's avatar
Olivier Crête committed
207
  script:
208 209
    - mkdir public/
    - mv build/docs/reference/libnice/html/ public/libnice/