summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 0b7c477ef13cd46ebd20936380fbe4c569b125bb (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
image: fedora:34

stages:
  - build
  - docs
  - deploy

.build-default:
  before_script:
    - dnf install -y ${FEDORA_DEPS}
    - pip3 install --user meson==${MESON_VERSION}
    - export PATH="$PATH:$HOME/.local/bin"
  script:
    - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
    - meson compile -C _build
    - meson test -C _build
    - meson install -C _build
  artifacts:
    when: always
    name: "json-glib-${CI_COMMIT_REF_NAME}"
    paths:
      - "${CI_PROJECT_DIR}/_build/meson-logs"

.gidocgen-build:
  image: fedora:latest
  before_script:
    - export PATH="$HOME/.local/bin:$PATH"
    - dnf install -y python3 python3-pip python3-wheel gobject-introspection-devel graphviz ninja-build redhat-rpm-config
    - dnf install -y ${PROJECT_DEPS}
    - pip3 install --user meson==${MESON_VERSION} gi-docgen jinja2 Markdown markupsafe pygments toml typogrify
  script:
    - meson setup ${MESON_EXTRA_FLAGS} ${DOCS_FLAGS} _docs .
    - meson compile -C _docs
    - |
      pushd "_docs/${DOCS_PATH}" > /dev/null
      tar cf ${CI_PROJECT_NAME}-docs.tar .
      popd > /dev/null
    - mv _docs/${DOCS_PATH}/${CI_PROJECT_NAME}-docs.tar .
  artifacts:
    when: always
    name: 'Documentation'
    expose_as: 'Download the API reference'
    paths:
      - ${CI_PROJECT_NAME}-docs.tar

fedora-x86_64:
  extends: .build-default
  stage: build
  needs: []
  variables:
    FEDORA_DEPS:
      gcc
      gettext
      git
      glib2-devel
      gobject-introspection-devel
      ninja-build
      python3
      python3-pip
      python3-wheel
      redhat-rpm-config
    MESON_VERSION: "0.62"
    MESON_EXTRA_FLAGS: "--buildtype=debug --default-library=both -Dwerror=true -Dglib:werror=false -Dintrospection=enabled"

reference:
  stage: docs
  needs: []
  extends: .gidocgen-build
  variables:
    PROJECT_DEPS:
      docbook-style-xsl
      gcc
      gettext
      git
      glib2-devel
      libxslt
    MESON_VERSION: "0.62"
    MESON_EXTRA_FLAGS: "-Dman=true -Dintrospection=enabled"
    DOCS_FLAGS: -Dgtk_doc=enabled
    DOCS_PATH: doc/json-glib-1.0

pages:
  stage: deploy
  needs: ['reference']
  script:
    - mkdir public && cd public
    - tar xf ../${CI_PROJECT_NAME}-docs.tar
  artifacts:
    paths:
      - public
  only:
    - master