.gitlab-ci.yml 4.59 KB
Newer Older
1 2 3
include:
 - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-definitions.yml'

4 5
stages:
  - build
6
  - test+docs
7
  - package
8
  - test-package
9
  - deploy
10

11 12
before_script:
  - apt-get -y update
13
  - apt-get -y install build-essential libgtk-3-doc libgdk-pixbuf2.0-doc lcov
14 15
  - apt-get -y build-dep .

Guido Gunther's avatar
Guido Gunther committed
16
.tags: &tags
17 18
  tags:
    - librem5
Guido Gunther's avatar
Guido Gunther committed
19

20 21 22 23 24 25
.build: &build_steps
    echo "BUILD_OPTS=${BUILD_OPTS}" &&
    export LC_ALL=C.UTF-8 &&
    meson ${BUILD_OPTS} . _build  &&
    ninja -C _build

Adrien Plazas's avatar
Adrien Plazas committed
26 27 28 29 30 31
api-visibility:
  <<: *tags
  stage: build
  script:
    - lint/api-visibility.sh

Guido Gunther's avatar
Guido Gunther committed
32 33 34
build-debian-gcc:
  image: debian:buster
  <<: *tags
35
  stage: build
36 37
  variables:
    BUILD_OPTS: -Dgtk_doc=true -Db_coverage=true --werror
38
  script:
39
    - *build_steps
Mohammed Sadiq's avatar
Mohammed Sadiq committed
40 41 42 43
  artifacts:
    when: always
    paths:
      - _build
44

45 46 47 48
build-debian-clang:
  image: debian:buster
  before_script:
    - apt-get -y update
49
    - apt-get -y install build-essential clang-tools
50
    - apt-get -y build-dep .
Guido Gunther's avatar
Guido Gunther committed
51
  <<: *tags
52 53 54 55 56 57 58 59 60 61 62 63 64
  stage: build
  script:
    - export LC_ALL=C.UTF-8
    - meson . _build
    # With meson 0.49 we can do
    # SCANBUILD="scan-build --status-bugs" ninja scan-build
    # https://github.com/mesonbuild/meson/commit/1e7aea65e68a43b0319a4a28908daddfec621548
    - ninja -C _build scan-build
  artifacts:
    when: always
    paths:
      - _build/meson-logs/scanbuild

65 66 67 68
build-fedora-gcc:
  image: fedora:29
  <<: *tags
  stage: build
69 70
  variables:
    BUILD_OPTS: -Dgtk_doc=true --werror
71 72 73 74 75
  before_script:
    - dnf -y update
    - dnf -y install @development-tools redhat-rpm-config dnf-plugins-core
    - dnf -y builddep data/packaging/rpm/libhandy.spec
  script:
76
    - *build_steps
77

78 79 80
build-gtkdoc:
  image: debian:buster
  <<: *tags
81
  stage: test+docs
82 83 84 85 86 87 88 89 90
  dependencies:
    - build-debian-gcc
  script:
    - ninja -C _build meson-libhandy-doc 2>&1 | tee _build/doc/buildlog
    - if grep -qs 'warning' _build/doc/buildlog; then exit 1; fi
  artifacts:
    when: always
    paths:
      - _build/doc/html
91 92 93 94

unit-test:
  image: debian:buster
  <<: *tags
95
  stage: test+docs
96 97 98 99 100 101 102 103 104 105
  dependencies:
    - build-debian-gcc
  script:
    - xvfb-run -s -noreset ninja -C _build test
    - ninja -C _build coverage
  coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
  artifacts:
    when: always
    paths:
      - _build
106

107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
package-debian-buster:
  extends: .l5-build-debian-package

package-debian-buster:arm64:
  tags:
    - librem5:arm64
  extends: .l5-build-debian-package

autopkgtest-debian-buster-package:
  dependencies:
    - package-debian-buster
  extends: .l5-autopkgtest-debian-package

lintian-debian-buster-package:
  dependencies:
    - package-debian-buster
  extends: .l5-lintian-debian-package
124

Guido Gunther's avatar
Guido Gunther committed
125 126
package-flatpak:
  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
127
  allow_failure: true
Guido Gunther's avatar
Guido Gunther committed
128 129 130 131 132
  tags:
    - flatpak
  stage: package
  variables:
    app_id: "sm.puri.Handy.Demo"
Adrien Plazas's avatar
Adrien Plazas committed
133
    manifest_path: "examples/${app_id}.json"
Guido Gunther's avatar
Guido Gunther committed
134 135 136 137 138 139
  artifacts:
    paths:
      - "${app_id}-dev.flatpak"
    expire_in: 1 day
  before_script:
    - flatpak install -y --noninteractive gnome-nightly org.gnome.Sdk org.gnome.Platform
Stelios Milidonis's avatar
Stelios Milidonis committed
140
    - rm -rf _build/
Guido Gunther's avatar
Guido Gunther committed
141
  script:
Adrien Plazas's avatar
Adrien Plazas committed
142
    - bash -x .gitlab-ci/flatpak-build.sh "${app_id}" "${manifest_path}"
Guido Gunther's avatar
Guido Gunther committed
143 144 145 146 147 148
  artifacts:
    when: always
    paths:
      - _build/meson-logs/meson-log.txt
      - sm.puri.Handy.Demo-dev.flatpak

Adrien Plazas's avatar
Adrien Plazas committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
package-flatpak-glade:
  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
  allow_failure: true
  tags:
    - flatpak
  stage: package
  variables:
    app_id: "sm.puri.Handy.Glade"
    manifest_path: "glade/${app_id}.json"
  artifacts:
    paths:
      - "${app_id}-dev.flatpak"
    expire_in: 1 day
  before_script:
    - flatpak install -y --noninteractive gnome-nightly org.gnome.Sdk org.gnome.Platform
Stelios Milidonis's avatar
Stelios Milidonis committed
164
    - rm -rf _build/
Adrien Plazas's avatar
Adrien Plazas committed
165 166 167 168 169 170 171 172
  script:
    - bash -x .gitlab-ci/flatpak-build.sh "${app_id}" "${manifest_path}"
  artifacts:
    when: always
    paths:
      - _build/meson-logs/meson-log.txt
      - sm.puri.Handy.Glade-dev.flatpak

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
publish-docs:
  stage: deploy
  dependencies:
    - build-gtkdoc
  environment:
    name: production
    url: https://developer.puri.sm/projects/libhandy/
  before_script:
    - export DEBIAN_FRONTEND=noninteractive
    - apt-get -y update
    - apt-get -y install ssh rsync
  tags:
    - librem5
  script:
    # Don't publish in forks
    - '[ "$CI_PROJECT_NAMESPACE" == "Librem5" ] || exit 0'
    - mkdir -p ~/.ssh/
    - chmod 0700 ~/.ssh/
    - echo "$SSH_HOST_KEY" > ~/.ssh/known_hosts
    - touch ~/.ssh/id_rsa
    - chmod 0600 ~/.ssh/id_rsa
    - echo "$SSH_KEY" >> ~/.ssh/id_rsa
    - rsync -av -i --stats -e "ssh -l $SSH_USER -i ~/.ssh/id_rsa -p $SSH_PORT" _build/doc/html/ "$RSYNC_TARGET"
  only:
    - master