summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: fe0f322363bd01d88de9f308f230f21f25dbe5a2 (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
include:
  - project: 'freedesktop/ci-templates'
    ref: master
    file: '/templates/fedora.yml'

variables:
  FDO_DISTRIBUTION_TAG: latest
  FDO_DISTRIBUTION_VERSION: rawhide
  FDO_UPSTREAM_REPO: "upower/$CI_PROJECT_NAME"
  FEDORA_IMAGE: "$CI_REGISTRY/upower/$CI_PROJECT_NAME/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG"
  DEPENDENCIES:
    gtk-doc
    meson
    gettext-devel
    gcc
    redhat-rpm-config
    gcc-c++
    glibc-devel
    systemd
    sqlite-devel
    gobject-introspection-devel
    libgudev-devel
    libimobiledevice-devel
    glib2-devel
    libplist-devel
    umockdev
    dbus-x11
    python3-gobject
    python3-dbusmock
    python3-pip
    python3-packaging
    git
  LAST_ABI_BREAK: "9058d45685d1c7c08d52fb64c393fed9eeed542b"

stages:
  - check-source
  - build
  - test

image: $FEDORA_IMAGE

test_nut_hwdb:
  stage: check-source
  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"
  allow_failure: true
  script:
    - curl https://raw.githubusercontent.com/networkupstools/nut/master/scripts/upower/95-upower-hid.hwdb >rules/95-upower-hid.hwdb
    - git diff
    - "! git status -s | grep -q ."

build:
  stage: build
  script:
    - meson _build -Dintrospection=enabled -Dman=true -Dgtk-doc=true -Didevice=enabled
    - ninja -C _build
  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"
  # avoid recompiling in test stage
  artifacts:
    name: untracked
    paths: [$(pwd)]
    expire_in: 3h30min


# Compile test the other backends (they don't have extra dependencies currently)
.build_backend_template: &build_backend
  stage: build
  script:
    - CFLAGS=-DUPOWER_CI_DISABLE_PLATFORM_CODE=1 meson _build -Dos_backend=$backend
    - ninja -C _build
  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"

build_dummy:
  variables:
    backend: dummy
  <<: *build_backend

build_freebsd:
  variables:
    backend: freebsd
  <<: *build_backend

build_openbsd:
  variables:
    backend: openbsd
  <<: *build_backend

test:
  stage: test
  dependencies:
   - build
  script:
    - meson test -C _build --print-errorlogs --no-stdsplit
    - .ci/fail_skipped_tests.py _build/meson-logs/testlog.junit.xml

  artifacts:
    when: always
    expire_in: 1 week
    paths:
      - "${CI_PROJECT_DIR}/_build/meson-logs/"
  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"

check_abi:
  stage: test
  script:
    - check-abi --suppr .ci/upower.suppr --parameters="-Dman=false -Dgtk-doc=false -Didevice=enabled"  ${LAST_ABI_BREAK} $(git rev-parse HEAD)
  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"


# CONTAINERS creation stage
container_fedora_build:
  extends: .fdo.container-build@fedora
  only:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
  variables:
    GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
    FDO_FORCE_REBUILD: 1
    # a list of packages to install
    FDO_DISTRIBUTION_PACKAGES:
      $DEPENDENCIES
    FDO_DISTRIBUTION_EXEC: |
      curl https://gitlab.freedesktop.org/hadess/check-abi/-/raw/main/contrib/check-abi-fedora.sh | bash