include:
  - project: 'gnome/citemplates'
    file: 'flatpak/flatpak_ci_initiative.yml'

variables:
  MANIFEST_PATH: 'demo/org.gnome.Adwaita1.Demo.json'
  FLATPAK_MODULE: 'libadwaita'
  FLATPAK_BUILD_DIR: build
  FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/libadwaita/fedora:v1"

stages:
  - build
  - publish
  - deploy

api-visibility:
  stage: build
  before_script: []
  script:
    - ./.gitlab-ci/api-visibility.sh

doc:
  image: $FEDORA_IMAGE
  stage: build
  tags:
    - flatpak
  variables:
    MESON_ARGS: >-
      -Dgtk_doc=true
      -Dtests=false
      -Dvapi=false
  script:
    - meson --prefix=/app ${MESON_ARGS} _build
    - ninja -C _build
    - mv _build/doc/libadwaita-1 _doc/
  artifacts:
    paths:
      - _doc

build-flatpak:
  extends: '.flatpak'
  stage: build
  before_script: []
  variables:
    RUNTIME_REPO: 'https://nightly.gnome.org/gnome-nightly.flatpakrepo'
    APP_ID: 'org.gnome.Adwaita1.Demo'
    BUNDLE: 'org.gnome.Adwaita1.Demo.flatpak'

abi-check:
  image: $FEDORA_IMAGE
  stage: build
  variables:
    LAST_ABI_BREAK: "11849510ba90790093ae130a3e46033b1f908e57"
  script:
    - ./.gitlab-ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD)

refresh-doc:
  stage: publish
  only:
    refs:
    - 'main'
  script:
    - "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=pages https://gitlab.gnome.org/api/v4/projects/14079/trigger/pipeline"

nightly:
  extends: '.publish_nightly'
  dependencies: ['build-flatpak']
  needs: ['build-flatpak']
