summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 791b12538ed639e6c48ca472c971968f7a32b409 (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
include:
    - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/0c312d9c7255f46e741d43bcd1930f09cd12efe7/templates/ci-fairy.yml"
    - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/0c312d9c7255f46e741d43bcd1930f09cd12efe7/templates/fedora.yml'

variables:
    MESON_TEST_TIMEOUT_MULTIPLIER: 3

stages:
    - review
    - prepare
    - build
    - test
    - analysis
    - website

.check-template: &check
  extends:
    - .fdo.ci-fairy
  artifacts:
    expire_in: 1 week
    paths:
      - check-junit-report.xml
    reports:
      junit: check-junit-report.xml

check-commit-log:
  variables:
    GIT_DEPTH: "100"
  stage: review
  script:
    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
      then
        ci-fairy check-commits --junit-xml=check-junit-report.xml ;
      else
        echo "Not a merge request" ;
      fi
  <<: *check

check-merge-request:
  variables:
    GIT_STRATEGY: none
  stage: review
  script:
    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
      then
        ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-junit-report.xml ;
      else
        echo "Not a merge request" ;
      fi
  <<: *check

.build-template: &build
  stage: build
  script:
      - git clone --depth=1 https://gitlab.gnome.org/GNOME/libsoup.git && pushd libsoup
      - meson _build --prefix=/usr -Dtls_check=false -Ddocs=disabled
      - ninja -C _build install
      - popd  
      - meson . build --prefix=/usr -Db_coverage=true
      - ninja -C build
  artifacts:
      expire_in: 1 day
      paths:
          - build

.gupnp.fedora@common:
  variables:
    BASE_TAG: '2022-08-16.1'
    FDO_UPSTREAM_REPO: GNOME/gupnp
    FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip xmlto gobject-introspection-devel gtk-doc libxml2-devel vala ninja-build libnghttp2-devel libpsl-devel sqlite-devel python3-setuptools'
    FDO_DISTRIBUTION_EXEC: |
      dnf clean all &&
      pip3 install meson markdown jinja2 Markdown markupsafe pygments toml typogrify gi-docgen

.soup3:
  before_script:
    - git clone --depth=1 https://gitlab.gnome.org/GNOME/libsoup.git && pushd libsoup
    - meson _build --prefix=/usr -Dtls_check=false -Ddocs=disabled
    - ninja -C _build install
    - popd

.gupnp.fedora:36@x86_64:
  extends: .gupnp.fedora@common
  variables:
    FDO_DISTRIBUTION_VERSION: 36
    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"

build-fedora-container@x86_64:
  extends:
    - .fdo.container-build@fedora
    - .gupnp.fedora:36@x86_64
  stage: prepare
  variables:
    GIT_STRATEGY: none


build-fedora@x86_64:
    extends:
        - .fdo.distribution-image@fedora
        - .gupnp.fedora:36@x86_64
    needs:
        - build-fedora-container@x86_64
    <<: *build


.test-template: &test
  stage: test
  variables:
    G_SLICE: "always-malloc"
    MALLOC_CHECK_: "3"
  script:
    - cd build
    - |
      # Remove the many "CI_" variables from the environment. Meson dumps the
      # whole environment for every failed test, and that gives a whole
      # screenful of junk each time unless we strip these.
      unset $(env|grep -o '^CI_[^=]*')
      env LANG=C.UTF-8 LC_ALL=C.UTF-8 meson test --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
  after_script:
    - |
      echo "Distribution: "
      echo
      egrep '^NAME=|^VERSION=' /etc/os-release
      echo
      echo "Test suite settings:"
      echo
      echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
      echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
      echo
      echo "These values can be set at https://gitlab.gnome.org/GNOME/gupnp/pipelines/new"
  artifacts:
    expire_in: 1 day
    when: always
    paths:
    - build
    reports:
      junit: "build/meson-logs/testlog.junit.xml"

test-fedora@x86_64:
  tags:
    - ipv6
  extends:
    - .fdo.distribution-image@fedora
    - .gupnp.fedora:36@x86_64
    - .soup3
  needs:
    - build-fedora@x86_64
  <<: *test

  #trigger-rygel:
  #stage: analysis
  #needs:
  #  - test-fedora@x86_64
  #trigger: GNOME/rygel
  #only:
  #  - master

coverage-analysis:
  extends:
    - .fdo.distribution-image@fedora
    - .gupnp.fedora:36@x86_64
    - .soup3
  stage: analysis
  allow_failure: true
  script:
    - cd build
    - mkdir -p coveragereport
    - gcovr --html-details --print-summary --root=.. --exclude=../build --exclude=../subprojects --exclude=../docs/reference --exclude=../tests --exclude=../tools --exclude=../examples --output coveragereport/index.html
  coverage: '/^lines: (\d+\.\d+\%)/'
  artifacts:
    when: always
    paths:
    - build/coveragereport
  needs:
    - test-fedora@x86_64

static-scan:
  extends:
    - .fdo.distribution-image@fedora
    - .gupnp.fedora:36@x86_64
    - .soup3
  stage: analysis
  needs:
    - build-fedora-container@x86_64
  script:
    - meson --buildtype=debug _scan_build
    - export SCANBUILD="$PWD/.gitlab-ci/scanbuild-wrapper.sh"
    - ninja -C _scan_build scan-build
  artifacts:
    paths:
      - _scan_build/meson-logs
  allow_failure: true
  after_script:
    - .gitlab-ci/scanbuild-plist-to-junit.py _scan_build/meson-logs/scanbuild/ > _scan_build/junit-scan-build.xml
  artifacts:
    reports:
      junit: "_scan_build/junit-scan-build.xml"

coverity:
  extends:
    - .fdo.distribution-image@fedora
    - .gupnp.fedora:36@x86_64
    - .soup3
  stage: analysis
  allow_failure: true
  script:
    - curl https://scan.coverity.com/download/linux64 --data "token=$COVERITY_TOKEN&project=gupnp" --output /tmp/coverity_tool.tgz
    - tar zxf /tmp/coverity_tool.tgz
    - mkdir coverity-build
    - cd coverity-build
    - env CC=clang meson ..
    - ../cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja
    - tar czf cov-int.tar.gz cov-int
    - curl https://scan.coverity.com/builds?project=gupnp
      --form token=$COVERITY_TOKEN --form email=mail@jensge.org
      --form file=@cov-int.tar.gz --form version="`git describe --tags`"
      --form description="gitlab CI build"
  needs:
    - build-fedora-container@x86_64
  only:
    - master
  except:
    changes:
      - po/*.po

pages:
  extends:
    - .fdo.distribution-image@fedora
    - .gupnp.fedora:36@x86_64
    - .soup3
  stage: website
  script:
      - meson doc-build -Dgtk_doc=true
      - ninja -C doc-build doc/gupnp-1.6
      - mkdir -p public
      - mv doc-build/doc/gupnp-1.6 public/docs
  artifacts:
    paths:
      - public
  needs:
    - build-fedora-container@x86_64
  only:
    - master
    - /^wip\/.*\/ci.*$/