summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: cd96e5536eb72f1554e66919b93a1d729d170352 (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
# 2022-05-19: ubuntu:latest = 22.04, ubuntu:rolling = 22.04, ubuntu:devel = 22.10
# See https://hub.docker.com/_/ubuntu
image: ubuntu:rolling

stages:
  - deps
  - build
  - deploy

variables:
  MESON_GCC_DEPS: g++
                  gettext
                  git
                  yelp-tools
                  python3-pygments
                  python3-setuptools
                  libcairo2-dev
                  mm-common
                  meson
                  ninja-build
  GIT_SUBMODULE_STRATEGY: normal

# In glibmm a cache is used for saving libsigc/ from the build_deps job.
# That's not possible in cairomm.
# It looks like a cache can be used only locally within a job.
# Result in the build_sigc job:
#   No URL provided, cache will be not uploaded to shared cache server.
#   Cache will be stored only locally.
# Result in subsequent jobs that try to download the cached files:
#   ninja: fatal: chdir to 'libsigc/_build' - No such file or directory

.build_default:
  before_script:
    - export DEBIAN_FRONTEND=noninteractive
    - apt update && apt -y upgrade && apt -y install $DEPENDENCIES

build_deps:
  extends: .build_default
  stage: deps
  variables:
    DEPENDENCIES: $MESON_GCC_DEPS docbook5-xml docbook-xsl

  script:
    # Build dependencies that can't be installed with apt.
    # Install to ./installdir, with the contents of the installed files
    # (notably .pc files) suited for installation to /usr.
    - export DESTDIR=`pwd`/installdir
    # Build libsigc++3
    - git clone --branch 3.2.0 --depth 1 https://github.com/libsigcplusplus/libsigcplusplus.git libsigc
    - cd libsigc
    - mkdir _build && cd _build
    - meson --prefix=/usr --libdir=lib -Dvalidation=false -Dbuild-examples=false -Dbuildtype=release
    - meson compile
    - meson install
  # Transfer the installed part of the built dependencies to later stages
  # as artifacts.
  artifacts:
    paths:
      - installdir/
    expire_in: 1 day

release_gcc_build:
  extends: .build_default
  stage: build
  variables:
    DEPENDENCIES: $MESON_GCC_DEPS
  script:
    - cp -r installdir/usr /
    - mkdir _build && cd _build
    # -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
    - meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal -Dwarning_level=3 -Dwerror=true
    - meson compile
    - meson test
    - meson install
  artifacts:
    when: always
    paths:
      - _build/docs/reference

release_clang_build:
  extends: .build_default
  stage: build
  variables:
    DEPENDENCIES: $MESON_GCC_DEPS clang
  script:
    - cp -r installdir/usr /
    - mkdir _build && cd _build
    # -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
    - CC=clang CXX=clang++ meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal -Dwarning_level=3 -Dwerror=true
    - meson compile
    - meson test
    - meson install
  allow_failure: true
  artifacts:
    when: on_failure
    paths:
      - _build/meson-logs/testlog.txt
      - _build/meson-logs/meson-log.txt
    expire_in: 1 week

# Publish reference documentation at cairo.pages.freedesktop.org/cairomm
pages:
  stage: deploy
  needs: [release_gcc_build]
  script:
    - mkdir public
    - mv _build/docs/reference/html/* public
  artifacts:
    paths:
      - public
  only:
    refs:
      - master