|
| 1 | +# Continuous Integration configuration for at-spi2-core |
| 2 | +# |
| 3 | +# For documentation on how this works, see devel-docs/gitlab-ci.md |
| 4 | +# |
| 5 | +# Full documentation for Gitlab CI: https://docs.gitlab.com/ee/ci/ |
| 6 | +# |
| 7 | +# Introduction to Gitlab CI: https://docs.gitlab.com/ee/ci/quick_start/index.html |
| 8 | + |
| 9 | +# Include the parameters we need from Freedesktop CI Templates |
| 10 | +include: |
| 11 | + - local: 'ci/container_builds.yml' |
| 12 | + |
| 13 | +# Stages in the CI pipeline in which jobs will be run |
| 14 | +stages: |
| 15 | + - container-build |
| 16 | + - style-check |
| 17 | + - build |
| 18 | + - analysis |
| 19 | + - docs |
| 20 | + - deploy |
| 21 | + |
| 22 | +# Enable merge request pipelines and avoid duplicate pipelines |
| 23 | +# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines |
| 24 | +workflow: |
| 25 | + rules: |
| 26 | + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' |
| 27 | + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push" |
| 28 | + when: never |
| 29 | + - if: '$CI_COMMIT_TAG' |
| 30 | + - if: '$CI_COMMIT_BRANCH' |
| 31 | + |
| 32 | +style-check-diff: |
| 33 | + extends: |
| 34 | + - '.container.opensuse@x86_64' |
| 35 | + - '.fdo.distribution-image@opensuse' |
| 36 | + needs: ['opensuse-container@x86_64'] |
| 37 | + stage: style-check |
| 38 | + script: |
| 39 | + - sh ./ci/run-style-check.sh |
| 40 | + |
| 41 | +# Default build recipe. |
| 42 | +# |
| 43 | +# Depends on these variables: |
| 44 | +# @MESON_EXTRA_FLAGS: extra arguments for the meson setup invocation |
| 45 | +opensuse-x86_64: |
| 46 | + stage: build |
| 47 | + extends: |
| 48 | + - '.container.opensuse@x86_64' |
| 49 | + - '.fdo.distribution-image@opensuse' |
| 50 | + needs: ['opensuse-container@x86_64'] |
| 51 | + variables: |
| 52 | + MESON_EXTRA_FLAGS: "--buildtype=debug" # -Dwerror=true |
| 53 | + script: |
| 54 | + # See https://gitlab.gnome.org/GNOME/at-spi2-core/-/merge_requests/137 for the reason for disable_p2p |
| 55 | + - meson setup ${MESON_EXTRA_FLAGS} -Ddisable_p2p=true --prefix /usr _build . |
| 56 | + - meson compile -C _build |
| 57 | + - meson install -C _build |
| 58 | + - mkdir /tmp/test+dir+with+funny+chars |
| 59 | + - export XDG_RUNTIME_DIR=/tmp/test+dir+with+funny+chars # See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/48 |
| 60 | + - xvfb-run --auto-servernum dbus-run-session -- ci/run-registryd-tests.sh |
| 61 | + - xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh |
| 62 | + artifacts: |
| 63 | + reports: |
| 64 | + junit: |
| 65 | + - "_build/meson-logs/testlog.junit.xml" |
| 66 | + - "_build/tests/registryd/registryd-pytest.junit.xml" |
| 67 | + when: always |
| 68 | + name: "at-spi2-core-${CI_COMMIT_REF_NAME}" |
| 69 | + paths: |
| 70 | + - "_build/meson-logs" |
| 71 | + - "_build/tests/registryd" |
| 72 | + |
| 73 | +fedora-x86_64: |
| 74 | + stage: build |
| 75 | + extends: |
| 76 | + - '.container.fedora@x86_64' |
| 77 | + - '.fdo.distribution-image@fedora' |
| 78 | + needs: ['fedora-container@x86_64'] |
| 79 | + variables: |
| 80 | + MESON_EXTRA_FLAGS: "--buildtype=debug -Ddefault_bus=dbus-broker -Ddbus_broker=/usr/bin/dbus-broker-launch" # -Dwerror=true |
| 81 | + script: |
| 82 | + - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build . |
| 83 | + - meson compile -C _build |
| 84 | + - meson install -C _build |
| 85 | + artifacts: |
| 86 | + reports: |
| 87 | + junit: "_build/meson-logs/testlog.junit.xml" |
| 88 | + when: always |
| 89 | + name: "at-spi2-core-${CI_COMMIT_REF_NAME}" |
| 90 | + paths: |
| 91 | + - "_build/meson-logs" |
| 92 | + |
| 93 | +# Run static analysis on the code. |
| 94 | +# |
| 95 | +# The logs are part of the compilation stderr. |
| 96 | +static-scan: |
| 97 | + stage: analysis |
| 98 | + extends: |
| 99 | + - '.container.opensuse@x86_64' |
| 100 | + - '.fdo.distribution-image@opensuse' |
| 101 | + needs: ['opensuse-container@x86_64'] |
| 102 | + variables: |
| 103 | + MESON_EXTRA_FLAGS: "--buildtype=debug -Dintrospection=disabled -Ddocs=false" |
| 104 | + script: |
| 105 | + - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _scan_build . |
| 106 | + - ninja -C _scan_build scan-build |
| 107 | + artifacts: |
| 108 | + name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" |
| 109 | + when: always |
| 110 | + paths: |
| 111 | + - "_scan_build/meson-logs/scanbuild" |
| 112 | + |
| 113 | +# Build and run with address sanitizer (asan). |
| 114 | +asan-build: |
| 115 | + stage: analysis |
| 116 | + extends: |
| 117 | + - '.container.opensuse@x86_64' |
| 118 | + - '.fdo.distribution-image@opensuse' |
| 119 | + needs: ['opensuse-container@x86_64'] |
| 120 | + variables: |
| 121 | + MESON_EXTRA_FLAGS: "--buildtype=debug -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Ddocs=false" |
| 122 | + # Add a suppressions file for address-sanitizer. Looks like libdbus has a minor leak that is hurting |
| 123 | + # the tests while run with asan. Hopefully this will go away once we convert everything to gdbus. |
| 124 | + # |
| 125 | + # https://gitlab.freedesktop.org/dbus/dbus/-/issues/326 |
| 126 | + LSAN_OPTIONS: "suppressions=${CI_PROJECT_DIR}/ci/address-sanitizer.supp" |
| 127 | + script: |
| 128 | + - CC=clang meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build . |
| 129 | + - meson compile -C _build |
| 130 | + - meson install -C _build |
| 131 | + - xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh |
| 132 | + artifacts: |
| 133 | + name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" |
| 134 | + when: always |
| 135 | + paths: |
| 136 | + - "${CI_PROJECT_DIR}/_build/meson-logs" |
| 137 | + allow_failure: true |
| 138 | + |
| 139 | +# Run the test suite and extract code coverage information. |
| 140 | +# |
| 141 | +# See the _coverage/ artifact for the HTML report. |
| 142 | +coverage: |
| 143 | + stage: analysis |
| 144 | + extends: |
| 145 | + - '.container.opensuse@x86_64' |
| 146 | + - '.fdo.distribution-image@opensuse' |
| 147 | + needs: ['opensuse-container@x86_64'] |
| 148 | + variables: |
| 149 | + MESON_EXTRA_FLAGS: "--buildtype=debug -Ddocs=false -Dintrospection=disabled" |
| 150 | + CFLAGS: "-coverage -ftest-coverage -fprofile-arcs" |
| 151 | + script: |
| 152 | + - source ./ci/env.sh |
| 153 | + # See https://gitlab.gnome.org/GNOME/at-spi2-core/-/merge_requests/137 for the reason for disable_p2p |
| 154 | + - meson setup ${MESON_EXTRA_FLAGS} -Ddisable_p2p=true --prefix /usr _build . |
| 155 | + - meson compile -C _build |
| 156 | + - meson install -C _build |
| 157 | + - xvfb-run --auto-servernum dbus-run-session -- ci/run-registryd-tests.sh |
| 158 | + - xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh |
| 159 | + - mkdir -p public |
| 160 | + - grcov _build --source-dir ./ --prefix-dir ../ --output-type cobertura --branch --ignore-not-existing -o coverage.xml |
| 161 | + - grcov _build --source-dir ./ --prefix-dir ../ --output-type html --branch --ignore-not-existing -o public/coverage |
| 162 | + # In the following line, the first grep finds what it is supposed to find, but exits with a nonzero code. |
| 163 | + # I have no idea why. So, force the whole pipeline to return true. |
| 164 | + - (grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }') || true |
| 165 | + coverage: '/Coverage: \d+\.\d+/' |
| 166 | + artifacts: |
| 167 | + name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" |
| 168 | + expire_in: 2 days |
| 169 | + when: always |
| 170 | + reports: |
| 171 | + coverage_report: |
| 172 | + coverage_format: cobertura |
| 173 | + path: coverage.xml |
| 174 | + paths: |
| 175 | + - "_build/meson-logs" |
| 176 | + - public |
| 177 | + - coverage.xml |
| 178 | + |
| 179 | +reference: |
| 180 | + stage: docs |
| 181 | + extends: |
| 182 | + - '.container.opensuse@x86_64' |
| 183 | + - '.fdo.distribution-image@opensuse' |
| 184 | + needs: ['opensuse-container@x86_64'] |
| 185 | + variables: |
| 186 | + MESON_EXTRA_FLAGS: "--buildtype=release -Ddocs=true" |
| 187 | + script: |
| 188 | + - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build . |
| 189 | + - ninja -C _build doc/atk doc/libatspi devel-docs/html |
| 190 | + - mkdir _reference |
| 191 | + - mv _build/doc/libatspi _reference/libatspi |
| 192 | + - mv _build/doc/atk _reference/atk |
| 193 | + - mv _build/devel-docs/html _reference/devel-docs |
| 194 | + artifacts: |
| 195 | + paths: |
| 196 | + - _reference |
| 197 | + - "_build/meson-logs" |
| 198 | + |
| 199 | +# Publish the test coverage report |
| 200 | +pages: |
| 201 | + stage: deploy |
| 202 | + needs: [ coverage, reference ] |
| 203 | + script: |
| 204 | + - mv _reference/* public/ |
| 205 | + artifacts: |
| 206 | + paths: |
| 207 | + - public |
| 208 | + rules: |
| 209 | + - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH) |
| 210 | + # Restrict it to the gnome namespace to avoid every fork pushing a set of pages by default |
| 211 | + # - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "gnome") |
0 commit comments